Skip to content

Instantly share code, notes, and snippets.

@justlaputa
Created June 7, 2018 23:33
Show Gist options
  • Save justlaputa/977d3f8c9fb1f43492f91d368be8c493 to your computer and use it in GitHub Desktop.
Save justlaputa/977d3f8c9fb1f43492f91d368be8c493 to your computer and use it in GitHub Desktop.
var app = express()
// handle GET /foo
app.get('/foo', function (req, res, next) {
res.end('foo')
})
// define a route and a group of handlers
app.route('/book')
.get(function (req, res) {
res.send('Get a random book')
})
.post(function (req, res) {
res.send('Add a book')
})
.put(function (req, res) {
res.send('Update the book')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment