-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
29 lines (24 loc) · 789 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
23
24
25
26
27
28
29
const express = require('express');
const app = express();
const cors = require('cors');
const bodyParser = require('body-parser');
const passport = require('passport');
const routesPost = require('./route/posts');
const routesUsers = require('./route/users');
const routesAuth = require('./route/auth');
const verifytoken = require('./api/services/verifytoken');
app.use(cors());
app.use(verifytoken);
app.use(passport.initialize());
app.use(express.static(__dirname + '/public'));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(routesAuth);
app.use(routesUsers);
app.use(routesPost);
app.use(function (err, req, res, next) {
res.json(err.message);
})
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});