January 2018
Intermediate to advanced
332 pages
7h 36m
English
Once we have the application shell created, create a file called index.js, which will be the main file of your application; you can call it anything you like, but make sure that you update the main property accordingly in your package.json.
Now, let's add some code to the index.js file to start an express server:
var express = require('express');var app = express();app.listen(3000, function () { console.log('Chat Application listening on port 3000!')});
That's it! The server is now up-and-running on the 3000 port. To test it, just add an empty route to tell you whether your application is up or not:
app.get('/', function (req, res) { res.status(200).send('OK!')});
You can go to your browser and navigate to localhost:3000 ...
Read now
Unlock full access