to-middleware

1.0.0 • Public • Published

to-middleware

Turn from server to connect/express middleware.

Install

$ npm install to-middleware

Usage

var middleware = require('to-middleware');
var express = require('express');
var http = require('http');
 
var server = http.createServer(function(req, res) {
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  res.end('Hello World\n');
});
 
var app = express();
 
app.use('/hello', middleware(server));

yields:

$ curl http://localhost:3000/hello
Hello World

License

MIT

Package Sidebar

Install

npm i to-middleware

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • nulltask