Created
March 20, 2012 20:29
-
-
Save jmibanez/2140974 to your computer and use it in GitHub Desktop.
Using restify with connect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍
Really helped some standalone development of a feature! (Mocked out a backend via grunt-contrib-connect + this middleware)