Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/lib/api/get-params.ts
1448 views
1
import type { Request } from "express";
2
3
export default function getParams(req: Request): { [param: string]: any } {
4
if (req?.method == "POST") {
5
return new Proxy(
6
{},
7
{
8
get(_, key) {
9
return req.body?.[key];
10
},
11
},
12
);
13
} else {
14
// only support params for POST requests.
15
return {};
16
}
17
}
18
19