From 8a8c42ddb2962ab4722774e7b8cc865bbef2b70f Mon Sep 17 00:00:00 2001 From: jw255 Date: Wed, 10 Jan 2018 12:58:28 +0000 Subject: updated readme, todo to explain/include changes. wrote a test for helloworld. all test files need .test.ts extension. --- src/app.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/app.ts') diff --git a/src/app.ts b/src/app.ts index fe00367..345b73f 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,13 +1,23 @@ -import * as express from 'express' +import * as express from 'express'; +import * as logger from 'morgan'; +import * as bodyParser from 'body-parser'; class App { public express constructor () { this.express = express() + this.middleware() this.mountRoutes() } + // Configure Express middleware. + private middleware(): void { + this.express.use(logger('combined')); + this.express.use(bodyParser.json()); + this.express.use(bodyParser.urlencoded({ extended: false })); + } + private mountRoutes (): void { const router = express.Router() router.get('/', (req, res) => { -- cgit v1.2.1