-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
27 lines (22 loc) · 674 Bytes
/
app.js
File metadata and controls
27 lines (22 loc) · 674 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
const express = require('express');
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const app = express();
const Router1 = express.Router();
//body-parser
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
//server
app.get('/', function(req,res){
res.send('Hello World!');
});
app.listen(6969, function(err){
console.log('listening on port 6969!');
});
mongoose.connect('mongodb://localhost:27017/exemploBooks', {
useNewUrlParser: true
});
mongoose.Promise = global.Promise;
const bookRouter = require('./books/routes/book.server.router');
app.use('/books', bookRouter(Router1));
module.exports = app;