-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7492de1
commit d558edb
Showing
179 changed files
with
1,300 additions
and
1,513 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
API_HOST=localhost | ||
API_PORT=3000 | ||
LOG_LEVEL=debug | ||
JWT_EXPIRATION=1d | ||
JWT_SECRET=secret | ||
NODE_ENV=development | ||
|
Binary file added
BIN
+23.7 KB
.yarn/cache/@ampproject-remapping-npm-2.1.2-d1536e36d6-e023f92cdd.zip
Binary file not shown.
Binary file removed
BIN
-8.49 KB
.yarn/cache/@babel-compat-data-npm-7.16.4-9128f11195-4949ce54ea.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+31 KB
...ator-npm-7.16.7-3cf12729b6-20c6a7c5e3.zip → ...ator-npm-7.17.9-314134f0b2-afbdd4afbf.zip
Binary file not shown.
Binary file renamed
BIN
+8.6 KB
...gets-npm-7.16.7-8031641957-7238aaee78.zip → ...gets-npm-7.17.7-b0b90e42d8-24bf851539.zip
Binary file not shown.
Binary file removed
BIN
-3.79 KB
.yarn/cache/@babel-helper-function-name-npm-7.16.7-aa24c7b296-fc77cbe7b1.zip
Binary file not shown.
Binary file added
BIN
+3.84 KB
.yarn/cache/@babel-helper-function-name-npm-7.17.9-baf558fead-a59b2e5af5.zip
Binary file not shown.
Binary file removed
BIN
-2.66 KB
.yarn/cache/@babel-helper-get-function-arity-npm-7.16.7-987b1b1bed-25d969fb20.zip
Binary file not shown.
Binary file removed
BIN
-12.1 KB
.yarn/cache/@babel-helper-module-transforms-npm-7.16.7-4b3d4b8254-6e930ce776.zip
Binary file not shown.
Binary file added
BIN
+12.3 KB
.yarn/cache/@babel-helper-module-transforms-npm-7.17.7-d26786bf84-0b8f023aa7.zip
Binary file not shown.
Binary file removed
BIN
-3.23 KB
.yarn/cache/@babel-helper-simple-access-npm-7.16.7-c4dfb1f5e7-8d22c46c5e.zip
Binary file not shown.
Binary file added
BIN
+3.26 KB
.yarn/cache/@babel-helper-simple-access-npm-7.17.7-3274d165af-58a9bfd054.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+2.15 KB
...isify-npm-1.1.2-2343f94380-d05081e088.zip → ...isify-npm-1.1.3-ac1a325862-4059f790e2.zip
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-14.2 KB
.yarn/cache/@humanwhocodes-config-array-npm-0.9.2-fda1e17bbb-28a9e2974c.zip
Binary file not shown.
Binary file added
BIN
+15 KB
.yarn/cache/@humanwhocodes-config-array-npm-0.9.5-030a025eae-8ba6281bc0.zip
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.1 KB
.yarn/cache/@jridgewell-resolve-uri-npm-3.0.5-bb57d127db-1ee652b693.zip
Binary file not shown.
Binary file added
BIN
+10.2 KB
.yarn/cache/@jridgewell-sourcemap-codec-npm-1.4.11-68fac44d63-3b2afaf840.zip
Binary file not shown.
Binary file added
BIN
+17.1 KB
.yarn/cache/@jridgewell-trace-mapping-npm-0.3.4-d0db906c7f-ab8bce84bb.zip
Binary file not shown.
Binary file renamed
BIN
+19.9 KB
...li-fs-npm-1.1.0-fa0ae1b053-e435b883b4.zip → ...li-fs-npm-2.1.0-3b106d08bc-6ec6d678af.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+18.7 KB
...dress-npm-4.1.3-cfd7949080-3c1faf6ef3.zip → ...dress-npm-4.1.4-32f94bc9f5-b9fca2a93a.zip
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-10.2 KB
.yarn/cache/@types-babel__core-npm-7.1.18-b880226f3e-2e5b5d7c84.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-22.3 KB
.yarn/cache/@types-express-serve-static-core-npm-4.17.27-a6c300c8eb-fef52b941f.zip
Binary file not shown.
Binary file added
BIN
+22.3 KB
.yarn/cache/@types-express-serve-static-core-npm-4.17.28-608d4aa166-826489811a.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+324 KB
...ode-npm-17.0.17-8bac2a57aa-8ddba2829a.zip → ...ode-npm-17.0.23-167849e796-a351755473.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-4.12 KB
.yarn/cache/@types-yargs-parser-npm-20.2.1-2eed5b5c1c-1d039e6449.zip
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-283 KB
.yarn/cache/@typescript-eslint-scope-manager-npm-5.12.0-38120bd90e-87cc4e8ab3.zip
Binary file not shown.
Binary file removed
BIN
-26.3 KB
.yarn/cache/@typescript-eslint-types-npm-5.12.0-2400bd6388-f5e7f8270c.zip
Binary file not shown.
Binary file removed
BIN
-123 KB
.yarn/cache/@typescript-eslint-typescript-estree-npm-5.12.0-0f6b2decf1-6a8e852c21.zip
Binary file not shown.
Binary file removed
BIN
-118 KB
.yarn/cache/@typescript-eslint-utils-npm-5.12.0-4a661f4ab8-34c394db05.zip
Binary file not shown.
Binary file removed
BIN
-9.12 KB
.yarn/cache/@typescript-eslint-visitor-keys-npm-5.12.0-e5aaacd6b9-c3774f542a.zip
Binary file not shown.
Binary file renamed
BIN
+14.4 KB
...alive-npm-4.2.0-e5e72b8ce4-89806f83ce.zip → ...alive-npm-4.2.1-b86a9fb343-39cb49ed8c.zip
Binary file not shown.
Binary file renamed
BIN
+6.72 KB
...e-yet-npm-2.0.0-7d2f5201ce-6c80b4fd04.zip → ...e-yet-npm-3.0.0-1391430190-348edfdd93.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+30.4 KB
...kidar-npm-3.5.2-6752340fec-d1fda32fcd.zip → ...kidar-npm-3.5.3-c5f9b0a56a-b49fcde401.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+5.91 KB
...oader-npm-1.0.3-eb5b513847-04ff1b2329.zip → ...oader-npm-1.0.9-87085bf3d5-26a0198e03.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-23.6 KB
.yarn/cache/electron-to-chromium-npm-1.4.36-ff93c0ba3c-bc3cba942c.zip
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+624 KB
...ract-npm-1.19.1-885c72759a-b6be841067.zip → ...ract-npm-1.19.2-acaaaa5311-4724811fd5.zip
Binary file not shown.
Binary file removed
BIN
-10.7 KB
.yarn/cache/eslint-visitor-keys-npm-3.1.0-9a6ffc9175-fd2d613bb3.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+38.8 KB
...-glob-npm-3.2.7-a2f0a45f5b-2f4708ff11.zip → ...glob-npm-3.2.11-bc01135fef-f473105324.zip
Binary file not shown.
Binary file renamed
BIN
+61.4 KB
...atted-npm-3.2.4-b14c5985c7-7d33846428.zip → ...atted-npm-3.2.5-0ee5a8875f-3c436e9695.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+8.46 KB
...obby-npm-11.0.4-592ce71cca-d3e02d5e45.zip → ...obby-npm-11.1.0-bdcdf20c71-b4be8885e0.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+9.84 KB
...-info-npm-4.0.2-7330924e0c-d1b2d77203.zip → ...-info-npm-4.1.0-4efcdf8fd3-c3f87b3c2f.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-6.23 KB
.yarn/cache/is-shared-array-buffer-npm-1.0.1-84bc270861-2ffb92533e.zip
Binary file not shown.
Binary file added
BIN
+6.87 KB
.yarn/cache/is-shared-array-buffer-npm-1.0.2-32e4181fcd-9508929cf1.zip
Binary file not shown.
Binary file renamed
BIN
+96.9 KB
...ports-npm-3.1.3-9b3e1f7cfc-ef6e0d9ed0.zip → ...ports-npm-3.1.4-5faaa9636c-2132983355.zip
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+61.6 KB
...json5-npm-2.2.0-da49dc7cb5-e88fc5274b.zip → ...json5-npm-2.2.1-44675c859c-74b8a23b10.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+496 KB
...e-gyp-npm-8.4.1-13c90a9c9b-341710b5da.zip → ...e-gyp-npm-9.0.0-0eccfca4d1-4d8ef8860f.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+6.78 KB
...pmlog-npm-6.0.0-94a534434f-33d8a7fe3d.zip → ...pmlog-npm-6.0.1-f597f2e057-f1a4078a73.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-12.6 KB
.yarn/cache/safe-stable-stringify-npm-1.1.1-1c282e1c55-e32a30720e.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+42.9 KB
...socks-npm-2.6.1-09133d0d22-2ca9d616e4.zip → ...socks-npm-2.6.2-94c1dcb8b8-dd91942930.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+34.5 KB
...he/ws-npm-7.5.6-957f210696-0c2ffc9a53.zip → ...he/ws-npm-7.5.7-6cc440864a-5c1f669a16.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+31 KB
...rser-npm-21.0.0-d564c0a5d4-1e205fca1c.zip → ...rser-npm-21.0.1-b778fd3462-c3ea2ed12c.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import Boom from 'boom'; | ||
import * as Boom from '@hapi/boom'; | ||
import { | ||
AbstractRepository, | ||
DeepPartial, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,44 @@ | ||
import * as winston from 'winston'; | ||
import { Ewl, LogLevel, httpContextMiddleware, requestIdHandler } from 'ewl'; | ||
import { Application } from 'express'; | ||
|
||
export let logger: winston.Logger; | ||
export let ewl: Ewl; | ||
|
||
export function init(): void { | ||
// Configure levels and transports, and set local variable | ||
logger = winston.createLogger({ | ||
level: 'debug', | ||
format: winston.format.combine( | ||
winston.format.timestamp(), | ||
winston.format.json(), | ||
winston.format.align() | ||
), | ||
levels: getCustomLogLevels().levels, | ||
transports: [ | ||
new winston.transports.File({ | ||
filename: `./logs/debug.log`, | ||
level: 'debug', | ||
}), | ||
new winston.transports.File({ | ||
filename: `./logs/info.log`, | ||
level: 'info', | ||
}), | ||
new winston.transports.File({ | ||
filename: `./logs/warn.log`, | ||
level: 'warning', | ||
}), | ||
new winston.transports.File({ | ||
filename: `./logs/error.log`, | ||
level: 'error', | ||
handleExceptions: true, | ||
}), | ||
], | ||
export function initEwl(app: Application): void { | ||
ewl = new Ewl({ | ||
attachRequestId: true, | ||
environment: process.env.ENVIRONMENT || 'development', | ||
label: 'app', | ||
logLevel: (process.env.LOG_LEVEL as LogLevel) || 'error', | ||
useLogstashFormat: false, | ||
version: process.env.VERSION || 'local', | ||
}); | ||
|
||
if (process.env.NODE_ENV !== 'production') { | ||
logger.add( | ||
new winston.transports.Console({ | ||
format: winston.format.combine( | ||
winston.format.timestamp({ | ||
format: 'YYYY-MM-DD HH:mm:ss', | ||
}), | ||
winston.format.colorize(), | ||
winston.format.align(), | ||
winston.format.printf((info) => { | ||
let msg = `${info.timestamp}`; | ||
msg = `${msg}: ${info.level}`; | ||
msg = `${msg}: ${info.message.trim()}`; | ||
return msg; | ||
}) | ||
), | ||
}) | ||
); | ||
} | ||
// Add custom colours | ||
winston.addColors(getCustomLogLevels().colors); | ||
} | ||
// Use express-winston for logging request information | ||
app.use( | ||
ewl.createHandler({ | ||
bodyBlacklist: ['accessToken', 'password', 'refreshToken'], | ||
colorize: true, | ||
expressFormat: false, | ||
headerBlacklist: ['cookie', 'token'], | ||
ignoreRoute: () => false, | ||
meta: true, | ||
metaField: 'express', | ||
msg: 'HTTP {{res.statusCode}} {{req.method}} {{res.responseTime}}ms {{req.url}}', | ||
requestWhitelist: [ | ||
'headers', | ||
'method', | ||
'httpVersion', | ||
'originalUrl', | ||
'query', | ||
'params', | ||
'url', | ||
], | ||
responseWhitelist: ['headers', 'statusCode'], | ||
statusLevels: true, | ||
}) | ||
); | ||
|
||
function getCustomLogLevels() { | ||
return { | ||
levels: { | ||
error: 1, | ||
warn: 2, | ||
info: 3, | ||
verbose: 4, | ||
debug: 5, | ||
silly: 6, | ||
}, | ||
colors: { | ||
error: 'red', | ||
warn: 'orange', | ||
info: 'yellow', | ||
debug: 'blue', | ||
verbose: 'white', | ||
silly: 'purple', | ||
}, | ||
}; | ||
// Use express-http-context for context injection (request id) | ||
app.use(httpContextMiddleware); | ||
app.use(requestIdHandler); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { NextFunction, Request, Response } from 'express'; | ||
|
||
import { logger } from '@/logger'; | ||
import { ewl } from '@/logger'; | ||
|
||
export function loggerMiddleware(req: Request, _: Response, next: NextFunction): void { | ||
logger.debug(`${req.method} ${req.path}`); | ||
ewl.debug(`${req.method} ${req.path}`); | ||
next(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.