Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

web6

mk-pmb15ISC0.1.4

Shim the "web" framework's socketHandler function for node.js v6.x

web, socketHandler, shim

readme



web6

Shim the "web" framework's socketHandler function for node.js v6.x

In theory, you can just add the digit 6 to your require('web') and it should work. If you know of any tests for "web" interface compatibility, please let me know so I can improve this shim to accomodate them.

Usage

from test/hello-server.js:

var web = require('web6'), makeApp = require('./hello-app.js'),
  app, appOpts = { greeting: 'Hello World!' },
  tcpServer = net.createServer(), tcpConnectionHandler;

if (cfg.announceExtras) {
  appOpts.greeting += ('\n\nWere you looking for one of these extras?\n' +
    cfg.announceExtras);
}

app = makeApp(appOpts);   // function (request, respond) { … }
if (cfg.addExtras) { app = cfg.addExtras(app); }

tcpConnectionHandler = web.socketHandler(app, { debug: true });
tcpServer.on('connection', tcpConnectionHandler);

tcpServer.on('listening', announceServerUrl(tcpServer));
tcpServer.listen(cfg.port, cfg.iface);

More examples:

License

ISC