diff options
| author | Tom Harley | 2018-02-08 17:13:34 +0000 |
|---|---|---|
| committer | Tom Harley | 2018-02-08 17:13:34 +0000 |
| commit | 2c520720c4292d0db159be2655742cd0f82e0880 (patch) | |
| tree | f03ff7ba019fa07ffddd3949aae7e4a5456cdc75 /src/index.ts | |
| parent | models should now do basic functioning (diff) | |
| download | medicine-2c520720c4292d0db159be2655742cd0f82e0880.tar.gz medicine-2c520720c4292d0db159be2655742cd0f82e0880.zip | |
configured server to use pg server on lab machines
Diffstat (limited to 'src/index.ts')
| -rw-r--r-- | src/index.ts | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/index.ts b/src/index.ts index 69150e2..a8756ad 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,14 +1,24 @@ -console.log('Welcome to the CS3099 Server thingy!'); - -import app from './app' +import { default as seq } from './db/orm'; +import { default as app } from './app'; // use default port 3000 or port supplied by OS -const port = process.env.PORT || 3000 +const port: number = process.env.PORT || 3000; + +(async () => { + console.log('Booting PSQL database'); + + await seq.authenticate(); + await seq.sync({ + force: true + }); -app.listen(port, (err) => { - if (err) { - return console.log(err) - } + console.log('Booting ExpressJS server'); - return console.log(`server is listening on port ${port}`) -})
\ No newline at end of file + app.listen(port, (err) => { + if (err) { + return console.log(err); + } else { + return console.log(`server is listening on port ${port}`); + } + }); +})(); |
