This commit updates how the service handles startup
This commit is contained in:
parent
614886fcd7
commit
8888b5d1ad
21
server.js
21
server.js
@ -5,15 +5,9 @@ const ObjectId = require("mongodb").ObjectID;
|
||||
const CONNECTION_URL = "mongodb+srv://edgenetworknode:yUiWfJBYCGwdRayj@matchnethop.hgxv0xd.mongodb.net/?retryWrites=true&w=majority";
|
||||
const DATABASE_NAME = "edgecomm";
|
||||
const COLLECTION_NAME = "nettranslate";
|
||||
const sha256 = require('js-sha256');
|
||||
var cors = require('cors');
|
||||
const Collection = require("mongodb/lib/collection");
|
||||
const Db = require("mongodb/lib/db");
|
||||
const MongoClient = require("mongodb").MongoClient;
|
||||
const request = require('undici');
|
||||
const axios = require('axios');
|
||||
const requestIp = require('request-ip');
|
||||
let requestEnable = false;
|
||||
var app = Express();
|
||||
app.use(cors());
|
||||
app.use(BodyParser.json());
|
||||
@ -25,6 +19,7 @@ var corsOptions = {
|
||||
optionsSuccessStatus: 200 // some legacy browsers (IE11, various SmartTVs) choke on 204
|
||||
}
|
||||
var database, collection;
|
||||
var requestEnable = false;
|
||||
/**GET*/
|
||||
app.get("/", (request, response) => {
|
||||
response.json({
|
||||
@ -41,6 +36,7 @@ app.get("/lobby/listall/", async (request, response) => {
|
||||
Field LBN[num] breaks down into Lobby Name [Number], this informs the client what the name is of the assosiated lobby
|
||||
Field LBIP[num] breaks down into Lobby IP [Number], this informs the client what the IP is of the assosiated lobby
|
||||
*/
|
||||
if (requestEnable) {
|
||||
var o_id = new mongodb.ObjectID();
|
||||
var ar;
|
||||
auth.insertOne({
|
||||
@ -71,6 +67,7 @@ app.get("/lobby/listall/", async (request, response) => {
|
||||
responseEnabled = false;
|
||||
enableLookup = false;
|
||||
response.status(200).json({
|
||||
Info: "Good",
|
||||
LBN : res.lobbies,
|
||||
LBIP : res.ip,
|
||||
LobbyCount : res.LobbyCount
|
||||
@ -104,7 +101,10 @@ app.get("/lobby/listall/", async (request, response) => {
|
||||
enableLookup = false;
|
||||
res = null;
|
||||
if (responseEnabled) {
|
||||
response.sendStatus(500);
|
||||
response.status(503).json({
|
||||
Info: "Forbidden",
|
||||
Message: "Something went wrong..."
|
||||
});
|
||||
}
|
||||
responseEnabled = false;
|
||||
console.log(err);
|
||||
@ -113,6 +113,13 @@ app.get("/lobby/listall/", async (request, response) => {
|
||||
}
|
||||
verifyUser();
|
||||
});
|
||||
} else {
|
||||
response.status(503).json({
|
||||
Info: "Forbidden",
|
||||
Message: "The server is starting up, please retry again in a moment."
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
app.get("/lobby/submit/", async (request, response) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user