-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
30 lines (25 loc) · 1.06 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// external dependencies
import * as chalk from 'chalk';
import { config as configureEnvironmentVariables } from 'dotenv';
import * as express from 'express';
import * as _ from 'lodash';
// configure all of the environment variables that exist within the local .env file
// note: this should happen before we bring in any internal dependencies (in case they rely on
// something to be loaded)
configureEnvironmentVariables();
// internal dependencies
import { config } from './src/config';
import { configureMiddleware } from './src/configure-middleware';
import { log } from './src/log';
import { registerAuthenticationRoute } from './src/register-authentication-route';
import { registerCatchAll } from './src/register-catch-all';
// constants
const app: express.Application = express();
const port: number = _.toInteger(config.port);
// initialize the server and all of its dependencies
configureMiddleware(app);
registerAuthenticationRoute(app);
registerCatchAll(app);
// lastly, begin listening for requests
app.listen(port);
log(`Listening on port ${chalk.cyan(port)}...`);