model filling
This commit is contained in:
parent
c27c061c15
commit
6ca82f8c2e
29 changed files with 245 additions and 132 deletions
|
@ -5,7 +5,7 @@ import locator from "../di/register_di";
|
|||
import { DevEnv, UnitTestEnv } from "../di/env";
|
||||
import mongoose from "mongoose";
|
||||
import http from "http";
|
||||
import { Server } from "socket.io";
|
||||
// import { Server } from "socket.io";
|
||||
|
||||
export class App {
|
||||
public app: express.Application;
|
||||
|
@ -14,13 +14,14 @@ export class App {
|
|||
public computedFolder: string;
|
||||
// public io:
|
||||
constructor(routes: Routes[], computedFolder: string) {
|
||||
this.app = express();
|
||||
this.port = Number(process.env.PORT) || 3000;
|
||||
this.port = 3000;
|
||||
this.env = "dev";
|
||||
this.initializeMiddlewares();
|
||||
this.initializeRoutes(routes);
|
||||
this.loadAppDependencies();
|
||||
this.computedFolder = computedFolder;
|
||||
this.loadAppDependencies().then(() => {
|
||||
this.app = express();
|
||||
this.initializeMiddlewares();
|
||||
this.initializeRoutes(routes);
|
||||
this.computedFolder = computedFolder;
|
||||
});
|
||||
}
|
||||
|
||||
public listen() {
|
||||
|
@ -28,6 +29,7 @@ export class App {
|
|||
// const io = new Server(httpServer);
|
||||
|
||||
httpServer.listen(this.port, () => {
|
||||
console.log(this.port);
|
||||
console.info(`=================================`);
|
||||
console.info(`======= ENV: ${this.env} =======`);
|
||||
console.info(`🚀 HTTP http://localhost:${this.port}`);
|
||||
|
@ -44,7 +46,6 @@ export class App {
|
|||
// io.emit("goodbye");
|
||||
// console.log(200);
|
||||
// }, 1000);
|
||||
|
||||
}
|
||||
|
||||
public getServer() {
|
||||
|
@ -62,8 +63,8 @@ export class App {
|
|||
this.app.use("/", route.router);
|
||||
});
|
||||
}
|
||||
loadAppDependencies() {
|
||||
locator(
|
||||
async loadAppDependencies() {
|
||||
await locator(
|
||||
this.env == "development"
|
||||
? new DevEnv(this.computedFolder)
|
||||
: new UnitTestEnv(this.computedFolder)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue