-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
54 lines (29 loc) · 917 Bytes
/
app.js
File metadata and controls
54 lines (29 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const path = require('path')
// require your essential files
var morgan = require('morgan')
app.use(morgan('combined'))
// initialize bodyParser here
app.use()
app.get('/', function(req, res) {
res.sendFile(__dirname + '/index.html');
});
// Set up a route for /api/books/ which can rerieve all the books in the database with GET method
app.get()
// Set up a route which can get a book by it's id
app.get('/api/books/:id',(req,res)=>{
})
// Set up a route which can retrieve all genres
app.get('/api/genres', (req,res)=>{
})
// set up a route which can save a new genre to your db
app.post('/api/genres', (req,res)=>{
})
// set up the route that can post a new book to your db
app.post('/api/books', (req,res)=>{
})
app.listen(3000, ()=>{
console.log('app is running on port 3000');
})