[create server using node.js] #nodejs #js
var express = require('express');
var app = express();
app.use(express.static(__dirname + '/public'));
// route pages
app.get('/', function (req, res) {
res.send('Main page is up and running!');
});
app.get('/user', function (req, res) {
res.send('TODO: update this page...');
});
// what port to run server on
app.listen(8888, function () {
console.log('server started on port 8888');
});
// source:
// https://coderbyte.com/tutorial/get-started-with-nodejs-and-express