-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.ts
More file actions
33 lines (23 loc) · 809 Bytes
/
app.ts
File metadata and controls
33 lines (23 loc) · 809 Bytes
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
31
32
33
require('dotenv').config();
import "reflect-metadata";
import * as express from 'express';
import * as cors from 'cors';
import * as moment from 'moment-timezone'
import { routes } from './src/routes';
import { CONFIG } from './src/config';
import { onError } from "./src/common/functions/on-error";
import { ServicesCollection } from "./src/providers";
import { Database } from "./src/data/database-config";
console.log('Initializing...');
const app = express();
app.use(cors());
app.options("*", cors());
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
moment.tz.setDefault('UTC');
app.use(routes);
ServicesCollection.resolve(Database);
app.use(onError);
app.listen(CONFIG.PORT, CONFIG.HOST, () => {
console.log(`Running on http://${CONFIG.HOST}:${CONFIG.PORT}`);
});