Teach handler to accept various methods
This commit is contained in:
@@ -61,14 +61,14 @@ const routes: Route[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/ok",
|
path: "/ok",
|
||||||
methods: ["GET"],
|
methods: ["GET", "POST", "PUT"],
|
||||||
handler: (_req: Request) => {
|
handler: (req: Request) => {
|
||||||
const code = httpCodes.success.OK;
|
const code = httpCodes.success.OK;
|
||||||
const rn = services.random.randomNumber();
|
const rn = services.random.randomNumber();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
code,
|
code,
|
||||||
result: "it is ok " + rn,
|
result: `that was ${req.method} (${rn})`,
|
||||||
contentType: contentTypes.text.plain,
|
contentType: contentTypes.text.plain,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user