-
Notifications
You must be signed in to change notification settings - Fork 1
/
sms-server.main.ts
37 lines (29 loc) · 947 Bytes
/
sms-server.main.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
31
32
33
34
35
36
37
/**
* @description holds server main
*/
import { DebugLogUtil, UsageUtil } from '@open-template-hub/common';
import cors from 'cors';
import dotenv from 'dotenv';
import express from 'express';
import { Routes } from './app/route/index.route';
const debugLogUtil = new DebugLogUtil();
// use .env file
const env = dotenv.config();
debugLogUtil.log( env.parsed );
// express init
const app: express.Application = express();
// public files
app.use( express.static( 'public' ) );
// parse application/json
app.use( express.json( { limit: '50mb' } ) );
app.use( cors() );
// mount routes
Routes.mount( app );
// listen port
const port: string = process.env.PORT || ( '4007' as string );
app.listen( port, () => {
console.info( 'SMS Server is running on port: ', port );
const usageUtil = new UsageUtil();
const memoryUsage = usageUtil.getMemoryUsage();
console.info( `Startup Memory Usage: ${ memoryUsage.toFixed( 2 ) } MB` );
} );