Updated package.json
This commit is contained in:
parent
a29ac8dda8
commit
496442fb77
2 changed files with 15 additions and 24 deletions
10
package.json
10
package.json
|
@ -2,10 +2,12 @@
|
||||||
"name": "nubian",
|
"name": "nubian",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Express backend for Khufu",
|
"description": "Express backend for Khufu",
|
||||||
"main": "server.js",
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node src/server.js --no-warnings",
|
"start": "node src/index.js --no-warnings",
|
||||||
"start:dev": "nodemon src/server.js"
|
"start:dev": "nodemon src/index.js",
|
||||||
|
"build": "npm run build:all",
|
||||||
|
"build:all": "docker-compose build"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -20,10 +22,8 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"cors": "^2.8.5",
|
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"express-bearer-token": "^2.4.0",
|
"express-bearer-token": "^2.4.0",
|
||||||
"lodash": "^4.17.21",
|
|
||||||
"mongoose": "^5.13.3",
|
"mongoose": "^5.13.3",
|
||||||
"multer": "^1.4.2",
|
"multer": "^1.4.2",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
|
|
|
@ -1,38 +1,29 @@
|
||||||
//Imports
|
// Imports
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const cors = require("cors");
|
|
||||||
const bodyParser = require("body-parser");
|
const bodyParser = require("body-parser");
|
||||||
const bearerToken = require("express-bearer-token");
|
const bearerToken = require("express-bearer-token");
|
||||||
//Local Imports
|
// Local Imports
|
||||||
const { Web, StatusCode, Server } = require("./config.json");
|
const { Web, StatusCode, Server } = require("./config.json");
|
||||||
//Import Routers
|
// Import Routers
|
||||||
const stashRouter = require("./routes/stash");
|
const stashRouter = require("./routes/stash");
|
||||||
//Define Constants & Setup Database
|
// Define Constants & Setup Database
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = Server.Port;
|
const port = Server.Port;
|
||||||
|
const timeout = 10 * 60 * 1000;
|
||||||
const debuggingMode = Server.Debug;
|
const debuggingMode = Server.Debug;
|
||||||
const viewOptions = { beautify: false };
|
const viewOptions = { beautify: false };
|
||||||
const corsOptions = {
|
// Set Up Express session and View engine
|
||||||
origin: "*",
|
|
||||||
optionsSuccessStatus: 200,
|
|
||||||
};
|
|
||||||
//Set Up Express session and View engine
|
|
||||||
app.use(cors(corsOptions));
|
|
||||||
app.use(bearerToken());
|
app.use(bearerToken());
|
||||||
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
|
||||||
//Test if there is a
|
app.use(["/nubian/api/stash", "/api/stash", "/stash"], stashRouter);
|
||||||
app.use(["/api/nubian/stash", "/api/stash", "/stash"], stashRouter);
|
|
||||||
const startServer = () => {
|
const startServer = () => {
|
||||||
server = app.listen(port, () => {
|
var server = app.listen(port, () => {
|
||||||
console.log("Node version:" + process.versions.node);
|
console.log("Node version:" + process.versions.node);
|
||||||
console.log(`Duneserver listening on port ${port}!`);
|
console.log(`Duneserver listening on port ${port}!`);
|
||||||
});
|
});
|
||||||
server.timeout = 10 * 60 * 1000;
|
server.timeout = timeout;
|
||||||
server.on("connection", (socket) => {
|
server.on("connection", (socket) => socket.setTimeout(timeout));
|
||||||
// 10 minutes timeout
|
|
||||||
socket.setTimeout(10 * 60 * 1000);
|
|
||||||
});
|
|
||||||
process.on("SIGINT", () => {
|
process.on("SIGINT", () => {
|
||||||
console.log("Recieved Shutdown Signal!");
|
console.log("Recieved Shutdown Signal!");
|
||||||
process.exit();
|
process.exit();
|
Reference in a new issue