web6

0.1.4 • Public • Published

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

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i web6

    Weekly Downloads

    5

    Version

    0.1.4

    License

    ISC

    Last publish

    Collaborators

    • mk-pmb