-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
22 lines (17 loc) · 782 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const express = require('express'); //importing require function
const routeBook = require('./routes/book');
const routeFavorite = require('./routes/favorites')
const routeClient = require('./routes/client');
const cors = require('cors'); //releasing server to receive requests
const app = express(); //creating require
app.use(express.json()) //used to receive the body for the post in the json
app.use(cors({ origin: "*" })) //releasing server to receive requests
const port = 8000; //defining port
//directing the path and which get should receive
app.use('/book', routeBook);
app.use('/favorites', routeFavorite);
app.use('/client', routeClient);
//leaving the application listening on port 8000
app.listen(port, () => {
console.log(`listening on port: ${port}`);
});