Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const express = require("express");
- const db = new (require("./DataBase"))();
- const app = express();
- app.get("/", (req, res) => res.send("hello world"));
- app.get("/authors", (req, res) => res.json(db.getAuthors()));
- app.get("/genres", (req, res) => res.json(db.getGenres()));
- app.get("/books/", (req, res) => res.json(db.getBooks()));
- app.get("/books/:id", (req, res) => res.json(db.getBookById(req.params.id)));
- app.listen(3000, () => console.log("listening port 3000"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement