@@ -4,8 +4,7 @@ import helmet from 'helmet';
44import morgan from 'morgan' ;
55import express from 'express' ;
66
7- import './db' ;
8- import './env' ;
7+ import pkg from '../package' ;
98import routes from './routes' ;
109import logger from './utils/logger' ;
1110import bodyParser from 'body-parser' ;
@@ -14,14 +13,12 @@ import * as errorHandler from './middlewares/errorHandler';
1413
1514const app = express ( ) ;
1615
17- const APP_PORT = ( process . env . NODE_ENV === 'test' ? process . env . TEST_APP_PORT : process . env . APP_PORT ) || '3000' ;
18- const APP_HOST = process . env . APP_HOST || '0.0.0.0' ;
16+ const PORT = process . env . PORT || '3000' ;
1917
20- app . set ( 'port' , APP_PORT ) ;
21- app . set ( 'host' , APP_HOST ) ;
18+ app . set ( 'port' , PORT ) ;
2219
23- app . locals . title = process . env . APP_NAME ;
24- app . locals . version = process . env . APP_VERSION ;
20+ app . locals . title = pkg . name ;
21+ app . locals . version = pkg . version ;
2522
2623app . use ( cors ( ) ) ;
2724app . use ( helmet ( ) ) ;
@@ -36,8 +33,8 @@ app.use('/api', routes);
3633app . use ( errorHandler . genericErrorHandler ) ;
3734app . use ( errorHandler . notFoundError ) ;
3835
39- app . listen ( app . get ( 'port' ) , app . get ( 'host' ) , ( ) => {
40- logger ( ) . info ( 'info' , `Server started at http:// ${ app . get ( 'host' ) } : ${ app . get ( 'port' ) } ` ) ;
36+ app . listen ( app . get ( 'port' ) , ( ) => {
37+ logger ( ) . info ( `Server listening is on port ${ app . get ( 'port' ) } ` ) ;
4138} ) ;
4239
4340export default app ;
0 commit comments