Advertisement
Guest User

Untitled

a guest
May 25th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const express = require("express");
  2. const db = new (require("./DataBase"))();
  3. const app = express();
  4.  
  5. app.get("/", (req, res) => res.send("hello world"));
  6. app.get("/authors", (req, res) => res.json(db.getAuthors()));
  7. app.get("/genres", (req, res) => res.json(db.getGenres()));
  8. app.get("/books/", (req, res) => res.json(db.getBooks()));
  9. app.get("/books/:id", (req, res) => res.json(db.getBookById(req.params.id)));
  10.  
  11. app.listen(3000, () => console.log("listening port 3000"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement