-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
29 lines (21 loc) · 678 Bytes
/
server.js
File metadata and controls
29 lines (21 loc) · 678 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
// filename server
// author andreferi
const express = require("express");
const bodyParser = require("body-parser");
const routes = require("./routes/routes");
const cors = require("cors");
const app = express();
// set port
const env = require('./config');
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());
const configCors = {
origin: ['http://192.168.100.15', 'http://192.168.100.56', 'http://192.168.100.28'],
methods: ['GET', 'POST', 'PATCH', 'DELETE']
};
app.use(cors(configCors));
routes(app);
// Listen to server with specified port
app.listen(env.PORT, () => {
console.log("Server listening at port : " + env.PORT);
});