aboutsummaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts30
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}`);
+ }
+ });
+})();