CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/lib/api/get-params.ts
Views: 687
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