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/get-one.ts
Views: 687
1
/* Get projects that belongs to the authenticated user.
2
If the user has no projects, creates one.
3
If they have projects, returns the most recently active one.
4
*/
5
6
import getAccountId from "lib/account/get-account";
7
import getOneProject from "@cocalc/server/projects/get-one";
8
9
export default async function handle(req, res) {
10
const account_id = await getAccountId(req);
11
try {
12
res.json(await getOneProject(account_id));
13
} catch (err) {
14
res.json({ error: err.message });
15
}
16
}
17
18