-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
26 lines (22 loc) · 786 Bytes
/
index.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
"use strict";
require("dotenv/config");
const express = require("express");
const app = express();
const routes = require("./web/routes/routes.js");
const logger = require("./config/components/winston.logger.js");
app.use(function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Credentials", "true");
res.header("Access-Control-Allow-Methods", "GET,PUT");
res.header("Access-Control-Expose-Headers", "Content-Length");
res.header(
"Access-Control-Allow-Headers",
"Accept, Authorization, Content-Type, X-Requested-With, Range"
);
return next();
});
app.use(express.json());
routes.routesConfig(app);
app.listen(process.env.PORT, function () {
logger.info(`app listening at port ${process.env.PORT}.`);
});