Path: blob/master/src/packages/next/pages/api/v2/jupyter/kernels.ts
1451 views
/*1Get all the available Jupyter kernels that the Jupyter API server2hosted here provides.34If project_id is specified, user must be signed in as a collab on that5project, and then they get the kernels that are supported by that project.6*/7import getKernels from "@cocalc/server/jupyter/kernels";8import getParams from "lib/api/get-params";9import getAccountId from "lib/account/get-account";1011export default async function handle(req, res) {12const { project_id } = getParams(req);13const account_id = project_id != null ? await getAccountId(req) : undefined;14try {15res.json({16kernels: await getKernels({ project_id, account_id }),17success: true,18});19} catch (err) {20res.json({ error: `${err.message}` });21return;22}23}242526