diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-04 21:57:24 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-04 21:57:24 +0200 |
commit | e563aa25b43e55eb86e5119edb71b0ccf20102ff (patch) | |
tree | 13487ab459b896b10d9dba2a38d77445bc075836 /api/src | |
parent | Merge branch 'master' of https://github.com/fosscord/fosscord-server (diff) | |
download | server-e563aa25b43e55eb86e5119edb71b0ccf20102ff.tar.xz |
:construction: different db engines
Diffstat (limited to 'api/src')
-rw-r--r-- | api/src/Server.ts | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/api/src/Server.ts b/api/src/Server.ts index 4a226d12..a16a61f8 100644 --- a/api/src/Server.ts +++ b/api/src/Server.ts @@ -1,4 +1,4 @@ -import { OptionsJson } from 'body-parser'; +import { OptionsJson } from "body-parser"; import "missing-native-js-functions"; import { Connection } from "mongoose"; import { Server, ServerOptions } from "lambert-server"; @@ -38,7 +38,6 @@ export class FosscordServer extends Server { await Config.init(); await initEvent(); - /* DOCUMENTATION: uses LOG_REQUESTS environment variable @@ -51,14 +50,16 @@ export class FosscordServer extends Server { */ let logRequests = process.env["LOG_REQUESTS"] != undefined; - if(logRequests) { - this.app.use(morgan("combined", { - skip: (req, res) => { - var skip = !(process.env["LOG_REQUESTS"]?.includes(res.statusCode.toString()) ?? false); - if(process.env["LOG_REQUESTS"]?.charAt(0) == '-') skip = !skip; - return skip; - } - })); + if (logRequests) { + this.app.use( + morgan("combined", { + skip: (req, res) => { + var skip = !(process.env["LOG_REQUESTS"]?.includes(res.statusCode.toString()) ?? false); + if (process.env["LOG_REQUESTS"]?.charAt(0) == "-") skip = !skip; + return skip; + } + }) + ); } this.app.use(CORS); @@ -90,8 +91,10 @@ export class FosscordServer extends Server { this.app.use(ErrorHandler); TestClient(this.app); - if(logRequests){ - console.log("Warning: Request logging is enabled! This will spam your console!\nTo disable this, unset the 'LOG_REQUESTS' environment variable!"); + if (logRequests) { + console.log( + "Warning: Request logging is enabled! This will spam your console!\nTo disable this, unset the 'LOG_REQUESTS' environment variable!" + ); } return super.start(); } |