diff options
Diffstat (limited to 'src/index.ts')
| -rw-r--r-- | src/index.ts | 49 |
1 files changed, 8 insertions, 41 deletions
diff --git a/src/index.ts b/src/index.ts index 06989ef..54ff848 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,9 @@ /* tslint:disable:no-console * This only goes here until we have a logging system */ -console.log('begin import'); -import { default as app } from './app'; -import { default as seq } from './db/orm'; -console.log('end import'); +import app from './app'; -import { default as UserGroup } from './db/model/UserGroup'; +console.log('Welcome to the CS3099 Server thingy!'); const DEFAULT_PORT: number = 3000; @@ -15,40 +12,10 @@ const port: number = process.env.PORT ? process.env.PORT : DEFAULT_PORT; -// tslint:disable:no-floating-promises -(async(): Promise<void> => { - console.log('Booting PSQL database'); +app.listen(port, (err: Error): void => { + if (err) { + return console.log(err); + } - await seq.authenticate(); - - console.log('Resetting Database'); - - await seq.sync({ - force: true - }); - - const admin: UserGroup = new UserGroup({ - name: 'admin', - canCreateUsers: true, - canDeleteUsers: true, - canEditUsers: true, - canCreateProjects: true, - canDeleteProjects: true, - canEditProjects: true, - isInternal: false, - description: 'Systems admin' - }); - - // tslint:disable:no-floating-promises - admin.save(); - - console.log('Booting ExpressJS server'); - - app.listen(port, (err: Error) => { - if (err) { - return console.log(err); - } else { - return console.log(`server is listening on port ${port}`); - } - }); -})(); + return console.log(`server is listening on port ${port}`); +}); |
