diff options
| author | jw255 | 2018-01-10 12:58:28 +0000 |
|---|---|---|
| committer | jw255 | 2018-01-10 12:58:28 +0000 |
| commit | 8a8c42ddb2962ab4722774e7b8cc865bbef2b70f (patch) | |
| tree | cd5a20138c05e0135febf875f36de0173d7f89fd /src/app.ts | |
| parent | modified README and made a script to install all packages, compile ts and run... (diff) | |
| download | medicine-8a8c42ddb2962ab4722774e7b8cc865bbef2b70f.tar.gz medicine-8a8c42ddb2962ab4722774e7b8cc865bbef2b70f.zip | |
updated readme, todo to explain/include changes. wrote a test for helloworld. all test files need .test.ts extension.
Diffstat (limited to 'src/app.ts')
| -rw-r--r-- | src/app.ts | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -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) => { |
