-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
executable file
·49 lines (24 loc) · 846 Bytes
/
server.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const https = require("https");
const fs = require("fs");
const express = require('express');
var cors = require('cors')
const bodyParser = require('body-parser');
const {MongoClient} = require('mongodb');
const mongoose = require('mongoose');
const options = {
key: fs.readFileSync("privkey.pem"),
cert: fs.readFileSync("fullchain.pem")
};
const app = express();
app.use(cors({origin: '*'}));
const city = require('./route/city.route'); // Importa rota
const timeline = require('./route/timeline.route'); // Importa rota
app.use(bodyParser.json())
app.use('/cities', city);
app.use('/timeline', timeline);
let uri_mongodb = 'mongodb://';
mongoose.connect(uri_mongodb);
var Schema = mongoose.Schema;
https.createServer(options, app).listen(8080, function(){
console.log("Express server listening on port ");
});