Skip to content

Instantly share code, notes, and snippets.

@ccoenraets
Created October 2, 2012 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ccoenraets/3816103 to your computer and use it in GitHub Desktop.
Save ccoenraets/3816103 to your computer and use it in GitHub Desktop.
var express = require('express'),
wines = require('./routes/wines');
var app = express();
app.get('/wines', wines.findAll);
app.get('/wines/:id', wines.findById);
app.listen(3000);
console.log('Listening on port 3000...');
exports.findAll = function(req, res) {
res.send([{name:'wine1'}, {name:'wine2'}, {name:'wine3'}]);
};
exports.findById = function(req, res) {
res.send({id:req.params.id, name: "The Name", description: "description"});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment