diff --git a/src/controllers/WelcomeController.ts b/src/controllers/WelcomeController.ts index 307813d..9a40c91 100644 --- a/src/controllers/WelcomeController.ts +++ b/src/controllers/WelcomeController.ts @@ -1,4 +1,3 @@ -import { Response, Request } from "express"; import { RequestHandler } from "../models/RequestHandler"; /** diff --git a/src/main.ts b/src/main.ts index ca8f7c2..4489e24 100644 --- a/src/main.ts +++ b/src/main.ts @@ -26,10 +26,15 @@ async function init() { // Process the list of routes Routes.forEach(route => { + const cb = (req : express.Request, res : express.Response)=> { + route.cb(new RequestHandler(req, res)); + }; + if(route.type == RouteType.GET) - app.get(route.path, (req : express.Request, res : express.Response)=> { - route.cb(new RequestHandler(req, res)); - }) + app.get(route.path, cb); + + else + app.post(route.path, cb); })