Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

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

install

npm i to-middleware

Downloadsweekly downloads

1

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar