Skip to content

Instantly share code, notes, and snippets.

@chriscantu
Last active December 30, 2015 07:49
Show Gist options
  • Save chriscantu/7798711 to your computer and use it in GitHub Desktop.
Save chriscantu/7798711 to your computer and use it in GitHub Desktop.
Restify - Hello World Example; #To Run:# 1. Copy file into a directory 2. Run `npm install restify` in the directory with app.js
var restify = require('restify'),
server = restify.createServer({
name: 'Hello World'
});
server.use(restify.gzipResponse());
var respond = function (req, res, next) {
res.send(200, {hello:'world'});
next();
};
server.get('/', respond);
server.listen(8080);
console.log('Starting Restify on port: 8080');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment