Public
Back
Version 13
7/23/2023
async function valToModule(req: express.Request, res: express.Response) {
try {
const { transpileVal } = await import(
"https://val2module.glitch.me/script.js?5"
);
const baseUrl = "https://" + req.get("host");
const [userHandle, valName] = req.path.split("/").slice(1).map((e) =>
decodeURIComponent(e)
);
res.type("js").send(
await transpileVal({
userHandle,
valName,
baseUrl,
}),
);
}
catch (e) {
res.type("js").send(`throw new Error(${JSON.stringify(e.message)})`);
}
}
Updated: October 23, 2023