mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-18 23:52:52 +00:00
refactor: avoid automatic execution of app.ts
Move the execution of configureApp to CLI file Related to #2
This commit is contained in:
committed by
Rainer Killinger
parent
9adc0b88d7
commit
59ea7a5ba6
10
src/app.ts
10
src/app.ts
@@ -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;
|
||||
});
|
||||
|
||||
10
src/cli.ts
10
src/cli.ts
@@ -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;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user