Added cors to the server & urls
This commit is contained in:
parent
9b964af050
commit
028a14fbe0
4 changed files with 14 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
|||
//Imports
|
||||
const express = require("express");
|
||||
const session = require("express-session");
|
||||
const cors = require("cors");
|
||||
const bodyParser = require("body-parser");
|
||||
const secret = require("uuid-with-v6").v6;
|
||||
//Local Imports
|
||||
|
@ -13,8 +14,12 @@ const app = express();
|
|||
const port = Server.Port;
|
||||
const debuggingMode = Server.Debug;
|
||||
const viewOptions = { beautify: false };
|
||||
|
||||
const corsOptions = {
|
||||
origin: "*",
|
||||
optionsSuccessStatus: 200,
|
||||
};
|
||||
//Set Up Express session and View engine
|
||||
app.use(cors(corsOptions));
|
||||
app.use(session({ secret: secret(), saveUninitialized: false, resave: false }));
|
||||
app.use(bodyParser.json({ limit: Server.BodyLimit })); // parse application/json
|
||||
app.use(bodyParser.urlencoded({ limit: Server.BodyLimit, extended: false })); // parse application/x-www-form-urlencoded
|
||||
|
|
Reference in a new issue