August 2017
Intermediate to advanced
278 pages
8h 53m
English
Express is so minimalistic that it doesn't come with any boilerplate code to get you started. There are a number of generators out there which can set up a structure for you, however, I'm going to stick to a simple web page and a WebSocket for testing. Here's my Express file:
var express = require('express');
var app = express();
var expressWs = require('express-ws')(app);
app.get('/', function (req, res) {
res.send('Nginx demo!!!');
});
app.ws('/echo', function(ws, req) {
ws.on('message', function(msg) {
ws.send(msg);
});
});
app.listen(3000);
Read now
Unlock full access