0.1.4 • Published 8 years ago

web6 v0.1.4

Weekly downloads
3
License
ISC
Repository
github
Last release
8 years ago

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

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago