-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.js
33 lines (22 loc) · 909 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
30
31
32
33
'use strict'
const express = require ('express')
const path = require ('path')
const morgan = require ('morgan')
const bodyParser = require ('body-parser')
const cors = require ('cors')
const http = require ('http')
const cluster = require ('cluster')
const validator = require ('express-validator')
const mongo = require ('./_config/mongoDB')
const app = express();
app.set('superSecret', '1a5H(qzO&1+!8M35tXvai3A*JF%Os]eOoG63/Oo+:1S(R[%x[js09UKDam0#85');
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(morgan('dev'));
app.use(cors());
app.use(express.static(path.join(__dirname, '/public')));
app.set('port', (process.env.PORT || 3000));
const port = app.get('port')
const server = http.createServer(app);
require('./routes')(app)
server.listen(port, () => console.log('Servidor rodando na porta: %d', port))