diff --git a/packages/server/src/application/Bootstrap.ts b/packages/server/src/application/Bootstrap.ts index c34830d..7a72069 100644 --- a/packages/server/src/application/Bootstrap.ts +++ b/packages/server/src/application/Bootstrap.ts @@ -5,8 +5,8 @@ import { AddressInfo } from 'net' import { Database } from '../database/Database' import { IDatabase } from '../database/IDatabase' import { loggerFactory, SqlLogger } from '../logger' -import { configureApplication } from './configureApplication' -import { createApplication } from './createApplication' +import { configureServer } from './configureServer' +import { createServer } from './createServer' import { IApplication } from './IApplication' import { IBootstrap } from './IBootstrap' import { IConfig } from './IConfig' @@ -37,7 +37,7 @@ export class Bootstrap implements IBootstrap { } protected createApplication(database: IDatabase): IApplication { - return createApplication(configureApplication(this.getConfig(), database)) + return createServer(configureServer(this.getConfig(), database)) } async exec(command: string = 'listen') { diff --git a/packages/server/src/application/IApplicationConfig.ts b/packages/server/src/application/IServerConfig.ts similarity index 77% rename from packages/server/src/application/IApplicationConfig.ts rename to packages/server/src/application/IServerConfig.ts index 70fd916..eab79e5 100644 --- a/packages/server/src/application/IApplicationConfig.ts +++ b/packages/server/src/application/IServerConfig.ts @@ -4,17 +4,17 @@ import { ILogger } from '@rondo.dev/logger' import { IServices } from './IServices' import { RequestHandlerParams, ErrorRequestHandler } from 'express-serve-static-core' -export interface IApplicationMiddleware { +export interface IServerMiddleware { path: string handle: RequestHandlerParams[] error?: ErrorRequestHandler } -export interface IApplicationConfig { +export interface IServerConfig { readonly config: IConfig readonly database: IDatabase readonly logger: ILogger readonly services: IServices readonly globalErrorHandler: ErrorRequestHandler - readonly framework: Record + readonly framework: Record } diff --git a/packages/server/src/application/configureApplication.ts b/packages/server/src/application/configureServer.ts similarity index 93% rename from packages/server/src/application/configureApplication.ts rename to packages/server/src/application/configureServer.ts index 0a65711..750e56a 100644 --- a/packages/server/src/application/configureApplication.ts +++ b/packages/server/src/application/configureServer.ts @@ -6,7 +6,7 @@ import * as Middleware from '../middleware' import * as Services from '../services' import * as Team from '../team' import * as User from '../user' -import { IApplicationConfig } from './IApplicationConfig' +import { IServerConfig } from './IServerConfig' import { IConfig } from './IConfig' import { IServices } from './IServices' import * as routes from '../routes' @@ -15,13 +15,13 @@ import { IRoutes, IContext } from '@rondo.dev/common' import { Express } from 'express-serve-static-core' export type AppConfigurator< - T extends IApplicationConfig = IApplicationConfig + T extends IServerConfig = IServerConfig > = ( config: IConfig, database: IDatabase, ) => T -export const configureApplication: AppConfigurator = (config, database) => { +export const configureServer: AppConfigurator = (config, database) => { const logger = loggerFactory.getLogger('api') diff --git a/packages/server/src/application/createApplication.ts b/packages/server/src/application/createServer.ts similarity index 80% rename from packages/server/src/application/createApplication.ts rename to packages/server/src/application/createServer.ts index a133340..159e886 100644 --- a/packages/server/src/application/createApplication.ts +++ b/packages/server/src/application/createServer.ts @@ -1,8 +1,8 @@ -import { IApplicationConfig } from './IApplicationConfig' +import { IServerConfig } from './IServerConfig' import { IApplication } from './IApplication' import express from 'express' -export function createApplication(appConfig: IApplicationConfig): IApplication { +export function createServer(appConfig: IServerConfig): IApplication { const {config, database, framework} = appConfig const server = express() diff --git a/packages/server/src/application/index.ts b/packages/server/src/application/index.ts index 2d53cf9..d19af9f 100644 --- a/packages/server/src/application/index.ts +++ b/packages/server/src/application/index.ts @@ -1,8 +1,7 @@ -export * from './Application' export * from './Bootstrap' export * from './IApplication' -export * from './IApplicationConfig' export * from './IConfig' +export * from './IServerConfig' export * from './IServices' -export * from './configureApplication' -export * from './createApplication' +export * from './configureServer' +export * from './createServer'