refactor: avoid automatic execution of app.ts

Move the execution of configureApp to CLI file

Related to #2
This commit is contained in:
Jovan Krunić
2019-07-04 11:30:49 +02:00
committed by Rainer Killinger
parent 9adc0b88d7
commit 59ea7a5ba6
2 changed files with 10 additions and 10 deletions

View File

@@ -46,7 +46,7 @@ export const app = express();
/**
* Configure the backend
*/
async function configureApp() {
export async function configureApp() {
// request loggers have to be the first middleware to be set in express
app.use(morgan('dev'));
@@ -206,11 +206,3 @@ async function configureApp() {
// TODO: implement a route to register plugins
}
configureApp()
.then(() => {
Logger.ok('Sucessfully configured express server');
})
.catch((err) => {
throw err;
});

View File

@@ -15,7 +15,7 @@
*/
import {Logger} from '@openstapps/logger';
import * as http from 'http';
import {app} from './app';
import {app, configureApp} from './app';
/**
* Get port from environment and store in Express.
@@ -94,3 +94,11 @@ function onListening() {
: `port ${addr.port}`;
Logger.ok(`Listening on ${bind}`);
}
configureApp()
.then(() => {
Logger.ok('Sucessfully configured express server');
})
.catch((err) => {
throw err;
});