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 /dist | |
| 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 'dist')
| -rw-r--r-- | dist/app.js | 9 | ||||
| -rw-r--r-- | dist/index.js | 5 |
2 files changed, 12 insertions, 2 deletions
diff --git a/dist/app.js b/dist/app.js index 7e34ef9..e983ca8 100644 --- a/dist/app.js +++ b/dist/app.js @@ -1,11 +1,20 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const express = require("express"); +const logger = require("morgan"); +const bodyParser = require("body-parser"); class App { constructor() { this.express = express(); + this.middleware(); this.mountRoutes(); } + // Configure Express middleware. + middleware() { + this.express.use(logger('combined')); + this.express.use(bodyParser.json()); + this.express.use(bodyParser.urlencoded({ extended: false })); + } mountRoutes() { const router = express.Router(); router.get('/', (req, res) => { diff --git a/dist/index.js b/dist/index.js index 9392034..7628251 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,11 +1,12 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -console.log('Hello, TypeScript!'); +console.log('Welcome to the CS3099 Server thingy!'); const app_1 = require("./app"); +// use default port 3000 or port supplied by OS const port = process.env.PORT || 3000; app_1.default.listen(port, (err) => { if (err) { return console.log(err); } - return console.log(`server is listening on ${port}`); + return console.log(`server is listening on port ${port}`); }); |
