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/compute/get-hyperstack-pricing-data.ts
Views: 687
1
/*
2
Get pricing data for Hyperstack cloud.
3
4
This gets a json object that can be used to efficiently browse and get pricing data
5
about almost everything related to Hyperstack VM's, similar to the google-cloud/pricing-data.
6
*/
7
8
import getAccountId from "lib/account/get-account";
9
import getPricingData from "@cocalc/server/compute/cloud/hyperstack/pricing-data";
10
11
export default async function handle(req, res) {
12
try {
13
res.json(await get(req));
14
} catch (err) {
15
res.json({ error: `${err.message}` });
16
return;
17
}
18
}
19
20
async function get(req) {
21
const account_id = await getAccountId(req);
22
if (!account_id) {
23
throw Error("must be signed in");
24
}
25
26
return await getPricingData();
27
}
28
29