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/pages/api/v2/projects/call.ts
Views: 687
1
/*
2
API endpoint that makes it possible to send a message to a project
3
that the user is a collaborator on and get back a response.
4
5
See cocalc/src/packages/server/projects/connection/call.ts
6
for a list of messages.
7
*/
8
9
import getParams from "lib/api/get-params";
10
import getAccountId from "lib/account/get-account";
11
import callProject from "@cocalc/server/projects/call";
12
13
export default async function handle(req, res) {
14
const account_id = await getAccountId(req);
15
try {
16
const { project_id, mesg } = getParams(req);
17
res.json(await callProject({ account_id, project_id, mesg }));
18
} catch (err) {
19
res.json({ error: err.message });
20
}
21
}
22
23