From f66a9fa7f132f41b2e40029f0fb535521c3fb716 Mon Sep 17 00:00:00 2001 From: jw255 Date: Sat, 24 Feb 2018 17:13:43 +0000 Subject: restructuring of tests + yarn install script --- coverage/project-code/src/app.ts.html | 197 ++++++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 coverage/project-code/src/app.ts.html (limited to 'coverage/project-code/src/app.ts.html') diff --git a/coverage/project-code/src/app.ts.html b/coverage/project-code/src/app.ts.html new file mode 100644 index 0000000..60f3e87 --- /dev/null +++ b/coverage/project-code/src/app.ts.html @@ -0,0 +1,197 @@ + + + + Code coverage report for project-code/src/app.ts + + + + + + + +
+
+

+ All files / project-code/src app.ts +

+
+
+ 90.48% + Statements + 19/21 +
+
+ 50% + Branches + 1/2 +
+
+ 100% + Functions + 5/5 +
+
+ 90.48% + Lines + 19/21 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +451x +1x +1x +1x +  +  +  +  +  +  +2x +2x +2x +2x +  +  +  +  +2x +  +  +  +2x +2x +  +  +  +  +2x +2x +3x +  +  +  +  +2x +2x +  +  +  +1x +1x +1x +  + 
import * as bodyParser from 'body-parser';
+import * as ex from 'express';
+import FileRouter from './FileRouter';
+import * as logger from 'morgan';
+ 
+class App {
+	public express: ex.Express;
+	private logEnabled: boolean;
+ 
+	public constructor(enableLog: boolean) {
+		this.express = ex();
+		this.middleware();
+		this.mountRoutes();
+		this.logEnabled = enableLog;
+	}
+ 
+	// Configure Express middleware.
+	private middleware(): void {
+		Iif (this.logEnabled) {
+			console.log("log enabled")
+			this.express.use(logger('combined'));
+		}
+		this.express.use(bodyParser.json());
+		this.express.use(bodyParser.urlencoded({ extended: false }));
+	}
+ 
+	// Configure API endpoints.
+	private mountRoutes(): void {
+		const defRouter: ex.Router = ex.Router();
+		defRouter.get('/', (req: ex.Request, res: ex.Response): void => {
+			res.json({
+				message: 'Welcome to the CS3099 BE4 server!',
+				important : 'Endpoints start from /cs3099group-be-4/'
+			});
+		});
+		this.express.use('/', defRouter);
+		this.express.use('/cs3099group-be-4', FileRouter);
+	}
+}
+ 
+export default new App(true).express;
+export function TestApp(){
+	return new App(false).express;
+} 
+ 
+
+
+ + + + + + + -- cgit v1.2.1