trigger screen
This commit is contained in:
parent
fbcfba3948
commit
d10a829882
30 changed files with 19101 additions and 26 deletions
|
@ -4,7 +4,7 @@ import cors from "cors";
|
|||
import locator from "../di/register_di";
|
||||
import { DevEnv, UnitTestEnv } from "../di/env";
|
||||
import mongoose from "mongoose";
|
||||
import http from "http";
|
||||
// import http from "http";
|
||||
// import { Server } from "socket.io";
|
||||
|
||||
export class App {
|
||||
|
@ -16,19 +16,19 @@ export class App {
|
|||
constructor(routes: Routes[], computedFolder: string) {
|
||||
this.port = 3000;
|
||||
this.env = "dev";
|
||||
this.app = express();
|
||||
this.computedFolder = computedFolder;
|
||||
this.loadAppDependencies().then(() => {
|
||||
this.app = express();
|
||||
this.initializeMiddlewares();
|
||||
this.initializeRoutes(routes);
|
||||
this.computedFolder = computedFolder;
|
||||
});
|
||||
}
|
||||
|
||||
public listen() {
|
||||
const httpServer = new http.Server(this.app);
|
||||
// const httpServer = new http.Server();
|
||||
// const io = new Server(httpServer);
|
||||
|
||||
httpServer.listen(this.port, () => {
|
||||
this.app.listen(this.port, () => {
|
||||
console.info(`=================================`);
|
||||
console.info(`======= ENV: ${this.env} =======`);
|
||||
console.info(`🚀 HTTP http://localhost:${this.port}`);
|
||||
|
|
|
@ -31,6 +31,7 @@ export class CoreHttpController<V> implements ICoreHttpController {
|
|||
|
||||
call(): Routes {
|
||||
if (this.routes["POST"] != null) {
|
||||
|
||||
this.router.post(
|
||||
this.url,
|
||||
validationModelMiddleware(this.validationModel),
|
||||
|
@ -72,6 +73,7 @@ export class CoreHttpController<V> implements ICoreHttpController {
|
|||
res: Response,
|
||||
usecase: CallBackFunction<T>
|
||||
) {
|
||||
|
||||
let payload = null;
|
||||
|
||||
if (req["model"] != undefined) {
|
||||
|
@ -85,7 +87,6 @@ export class CoreHttpController<V> implements ICoreHttpController {
|
|||
if (req.query.id !== undefined) {
|
||||
payload = String(req.query.id);
|
||||
}
|
||||
|
||||
(await usecase(payload)).fold(
|
||||
(ok) => {
|
||||
res.json(ok);
|
||||
|
|
|
@ -10,6 +10,7 @@ export const validationModelMiddleware = (
|
|||
forbidNonWhitelisted = true,
|
||||
): RequestHandler => {
|
||||
return (req, res, next) => {
|
||||
|
||||
if(type === null && type == undefined){
|
||||
next()
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue