forked from Meelan-98/GuideAstro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
29 lines (19 loc) · 838 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
27
28
29
var express = require('express');
const dotenv = require('dotenv');
var apiController = require("./RouteFacade/APIController");
var authController = require("./RouteFacade/authController");
var {RestoreSession} = require("./MODEL/Authentication");
var app = express();
dotenv.config();
RestoreSession();
app.use(express.urlencoded({extended: true}));
app.use(express.json())
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "http://localhost:3000"); // update to match the domain you will make the request from
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization");
res.header("Access-Control-Allow-Methods", "DELETE, PUT");
next();
});
app.use('/api',apiController);
app.use('/auth',authController);
app.listen(process.env.port);