Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { FunctionalRouter } from "./FunctionalRouter" import { Request, Response } from "./authentication" import { writeVariableCSV } from "../db/model/Variable" import { expectInt } from "../serverUtils/serverUtil" import { stringifyUnkownError } from "../clientUtils/Util" export const publicApiRouter = new FunctionalRouter() publicApiRouter.router.get( "/variables/:variableIds.csv", async (req: Request, res: Response) => { const variableIds = req.params.variableIds.split("+").map(expectInt) try { await writeVariableCSV(variableIds, res) res.end() } catch (error) { res.send(`Error: ${stringifyUnkownError(error)}`) } } ) |