Skip to content

Instantly share code, notes, and snippets.

@koptionalsoftware
Created November 5, 2018 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koptionalsoftware/d40c30796bae0429684cbc7740b8df76 to your computer and use it in GitHub Desktop.
Save koptionalsoftware/d40c30796bae0429684cbc7740b8df76 to your computer and use it in GitHub Desktop.
const express = require("express");
const app = express();
/**
* See https://expressjs.com/en/guide/routing.html#app-route
*/
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');
})
.delete(function(req, res) {
res.send('Deleted a book');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment