-
-
Save leoh/17b9d3a049fb8a2733e8 to your computer and use it in GitHub Desktop.
Revisions
-
leoh revised this gist
Sep 4, 2014 . 2 changed files with 25 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,27 @@ // Restify server config here var restify = require('restify'); var server = restify.createServer({ name: 'restify-test', version: '1.0.0' }); function respond(req, res, next) { res.send('hello ' + req.params.name); next(); } server.get('/hello/:name', respond); // Connect config here var connect = require("connect"); 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); //please test at localhost:8080/api/hello/leo This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ { "name": "restify-test", "description": "restify-test", "version": "0.0.1", "author": "Leo", "engines": { "node": ">= 0.4.0" }, "devDependencies": { "connect": "^2.25.9", "restify": "^2.8.2" } } -
jmibanez created this gist
Mar 20, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ // 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);