Created
May 28, 2012 18:52
-
-
Save robdodson/2820624 to your computer and use it in GitHub Desktop.
pickle store!
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
// Routes | |
var count = 100; | |
app.get('/', function(req, res) { | |
res.send('Welcome to the Pickle Store!'); | |
}); | |
app.get('/pickles', function(req, res) { | |
res.json({ | |
count: count, | |
message: 'oh boy, ' + count + ' pickles!' | |
}); | |
}); | |
app.get('/pickles/add/:num', function(req, res) { | |
count += parseInt(req.params.num); | |
res.json({ | |
add: req.params.num, | |
message: 'you added ' + req.params.num + ' pickles to the pickle barrel!' | |
}); | |
}); | |
app.listen(3000, function(){ | |
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment