aboutsummaryrefslogtreecommitdiff
path: root/src/index.ts
blob: a8756ad419328dac677b3d0b31de9e2205a3d9b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { default as seq } from './db/orm';
import { default as app } from './app';

// use default port 3000 or port supplied by OS
const port: number = process.env.PORT || 3000;

(async () => {
  console.log('Booting PSQL database');

  await seq.authenticate();
  await seq.sync({
    force: true
  });

  console.log('Booting ExpressJS server');

  app.listen(port, (err) => {
    if (err) {
      return console.log(err);
    } else {
      return console.log(`server is listening on port ${port}`);
    }
  });
})();