mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 05:19:22 +00:00
Add support for POST requests
This commit is contained in:
parent
71807d2677
commit
fe46644511
@ -1,4 +1,3 @@
|
||||
import { Response, Request } from "express";
|
||||
import { RequestHandler } from "../models/RequestHandler";
|
||||
|
||||
/**
|
||||
|
11
src/main.ts
11
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);
|
||||
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user