aboutsummaryrefslogtreecommitdiff
path: root/src/app.ts
diff options
context:
space:
mode:
authorjw2552018-02-22 16:57:45 +0000
committerjw2552018-02-22 16:57:45 +0000
commit77bfad0307f4e5daea0584a30b0dcf24ccc9ec42 (patch)
tree42ce68ae0ebe939d6492a39616158278ed0f61d6 /src/app.ts
parentMerge branch 'trh/yarn' into trh/payload-checker (diff)
downloadmedicine-77bfad0307f4e5daea0584a30b0dcf24ccc9ec42.tar.gz
medicine-77bfad0307f4e5daea0584a30b0dcf24ccc9ec42.zip

restructuring of tests

Diffstat (limited to 'src/app.ts')
-rw-r--r--src/app.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/app.ts b/src/app.ts
index 4f0e0d7..ef4485e 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -5,17 +5,19 @@ import * as logger from 'morgan';
class App {
public express: ex.Express;
- public logEnabled: boolean = true;
+ private logEnabled: boolean;
- public constructor() {
+ public constructor(enableLog: boolean) {
this.express = ex();
this.middleware();
this.mountRoutes();
+ this.logEnabled = enableLog;
}
// Configure Express middleware.
private middleware(): void {
if (this.logEnabled) {
+ console.log("log enabled")
this.express.use(logger('combined'));
}
this.express.use(bodyParser.json());
@@ -36,4 +38,7 @@ class App {
}
}
-export default new App().express;
+export default new App(true).express;
+export function TestApp(){
+ return new App(false).express;
+}