Skip to content

Instantly share code, notes, and snippets.

@jmibanez
Created March 20, 2012 20:29
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jmibanez/2140974 to your computer and use it in GitHub Desktop.
Save jmibanez/2140974 to your computer and use it in GitHub Desktop.
Using restify with connect
// Restify server config here
var server = restify.createServer({
name: 'restify-test',
version: '1.0.0',
});
// ...
// Connect config here
var connectApp = connect()
.use(connect.logger())
.use(connect.bodyParser())
.use(connect.query())
.use(connect.cookieParser())
// And this is where the magic happens
.use("/api", function (req, res) {
server.server.emit('request', req, res);
});
connectApp.listen(8080);
@whatever
Copy link

👍

Really helped some standalone development of a feature! (Mocked out a backend via grunt-contrib-connect + this middleware)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment