Added cors to the server & urls
This commit is contained in:
parent
9b964af050
commit
028a14fbe0
4 changed files with 14 additions and 7 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -1,7 +1,7 @@
|
||||||
# For Deploy
|
# For Deploy
|
||||||
src/node_modules/
|
package-lock.json
|
||||||
|
nodemon.json
|
||||||
|
node_modules/
|
||||||
src/desert/
|
src/desert/
|
||||||
src/package-lock.json
|
|
||||||
src/nodemon.json
|
|
||||||
src/zips/
|
src/zips/
|
||||||
src/uploads/
|
src/uploads/
|
||||||
|
|
|
@ -22,8 +22,10 @@
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"bcrypt": "^5.0.1",
|
"bcrypt": "^5.0.1",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
|
"cors": "^2.8.5",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"express-session": "^1.17.1",
|
"express-session": "^1.17.2",
|
||||||
|
"install": "^0.13.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"multer": "^1.4.2",
|
"multer": "^1.4.2",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"Storage": {
|
"Storage": {
|
||||||
"DesertPath": "desert/",
|
"DesertPath": "src/desert/",
|
||||||
"UploadPath": "uploads/",
|
"UploadPath": "src/uploads/",
|
||||||
"ZipPath": "zips/",
|
"ZipPath": "zips/",
|
||||||
"UserStorageSize": 2048,
|
"UserStorageSize": 2048,
|
||||||
"UserStorageUnit": 1048576,
|
"UserStorageUnit": 1048576,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
//Imports
|
//Imports
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const session = require("express-session");
|
const session = require("express-session");
|
||||||
|
const cors = require("cors");
|
||||||
const bodyParser = require("body-parser");
|
const bodyParser = require("body-parser");
|
||||||
const secret = require("uuid-with-v6").v6;
|
const secret = require("uuid-with-v6").v6;
|
||||||
//Local Imports
|
//Local Imports
|
||||||
|
@ -13,8 +14,12 @@ const app = express();
|
||||||
const port = Server.Port;
|
const port = Server.Port;
|
||||||
const debuggingMode = Server.Debug;
|
const debuggingMode = Server.Debug;
|
||||||
const viewOptions = { beautify: false };
|
const viewOptions = { beautify: false };
|
||||||
|
const corsOptions = {
|
||||||
|
origin: "*",
|
||||||
|
optionsSuccessStatus: 200,
|
||||||
|
};
|
||||||
//Set Up Express session and View engine
|
//Set Up Express session and View engine
|
||||||
|
app.use(cors(corsOptions));
|
||||||
app.use(session({ secret: secret(), saveUninitialized: false, resave: false }));
|
app.use(session({ secret: secret(), saveUninitialized: false, resave: false }));
|
||||||
app.use(bodyParser.json({ limit: Server.BodyLimit })); // parse application/json
|
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
|
app.use(bodyParser.urlencoded({ limit: Server.BodyLimit, extended: false })); // parse application/x-www-form-urlencoded
|
||||||
|
|
Reference in a new issue