-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
32 lines (26 loc) · 1010 Bytes
/
server.js
File metadata and controls
32 lines (26 loc) · 1010 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
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin",
"*");
res.header("Access-Control-Allow-Headers",
"Origin, X-Requested-With, Content-Type, Accept");
res.header("Access-Control-Allow-Methods",
"GET, POST, PUT, DELETE, OPTIONS");
res.header("Access-Control-Allow-Credentials", "true");
next();
});
app.get('/hello', (req, res) => {
res.send('Hello World!');
});
require('./web-dev-node/services/movies-service')(app);
require('./web-dev-node/services/tweets-service')(app);
require('./web-dev-node/services/profile-service')(app);
require('./movies/service')(app);
require('./web-dev-node/services/who-service')(app)
const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/webdev');
app.listen(process.env.PORT || 4000);