Created
October 2, 2012 04:05
-
-
Save ccoenraets/3816103 to your computer and use it in GitHub Desktop.
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
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...'); |
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
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