Skip to main content
Module

x/sustain_core/bootstrap.ts

A Framework that barely uses dependencies and it is designed especially to make stable and sustainable applications. 📦
Latest
File
import {Application} from './interfaces/application.interface.ts';import {SustainServer} from './server.ts';import {getAllModuleMetaData, executeOnServerStart} from './utils/module.helper.ts';import {loadControllers} from './utils/http-request.helper.ts';
class BootstrapFramework { application: Application; mainModuleMetaData: any; applicationRequests: any; constructor(app: any) { this.application = app; this.mainModuleMetaData = getAllModuleMetaData(this.application);
const {controllers, modules} = this.mainModuleMetaData;
this.applicationRequests = loadControllers(controllers); executeOnServerStart(modules, this.applicationRequests); this.bootServer(this.applicationRequests, this.mainModuleMetaData); }
bootServer(requests: any, mainModuleMetaData: any) { const {port, staticFolders = [], extensions = {}, middleswares = []} = mainModuleMetaData; new SustainServer(requests, { port, staticFolders, extensions, middleswares, }); }}/** * Boostratp the Application * @param app */export function bootstrap(app: any): any { new BootstrapFramework(app);}