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/customize.ts
Views: 687
1
/*
2
Return the entire customize object for the site, or
3
a subset of fields (to cut down on bandwidth).
4
5
This calls something that is LRU cached on the server for a few seconds.
6
*/
7
8
import getCustomize from "@cocalc/database/settings/customize";
9
import { copy_with } from "@cocalc/util/misc";
10
import getParams from "lib/api/get-params";
11
12
export default async function handle(req, res) {
13
const { fields } = getParams(req);
14
15
try {
16
const customize = await getCustomize();
17
let result = fields ? copy_with(customize, fields) : customize;
18
res.json(result);
19
} catch (err) {
20
res.json({ error: `${err.message}` });
21
}
22
}
23
24