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/filename-search.ts
Views: 687
1
/*
2
API endpoint to find files that you've edited in the
3
last year or so by their filename.
4
It's under 'projects' since it's also a way to find the
5
project you want to open.
6
*/
7
8
import getAccountId from "lib/account/get-account";
9
import getParams from "lib/api/get-params";
10
import { filenameSearch } from "@cocalc/server/projects/filename-search";
11
12
export default async function handle(req, res) {
13
const { search } = getParams(req);
14
try {
15
const account_id = await getAccountId(req);
16
if (!account_id) {
17
throw Error("must be signed in");
18
}
19
res.json(await filenameSearch({ search, account_id }));
20
} catch (err) {
21
res.json({ error: `${err.message}` });
22
}
23
}
24
25