Public
Express
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
export async function valToModule(req: express.Request, res: express.Response) {
try {
const { transpileVal } = await import(
"https://val2module.glitch.me/script.js?13"
);
const baseUrl = "https://" + req.get("host") + "/module/";
const [userHandle, valName] = req.path.split("/").slice(1).map((e) =>
decodeURIComponent(e)
).slice(-2);
res.type("js").send(
await transpileVal({
userHandle,
valName,
baseUrl,
v: req.query.v,
}),
);
}
catch (e) {
res.type("js").send(`throw new Error(${JSON.stringify(e.message)})`);
}
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
easrng-valtomodule.express.val.run
October 23, 2023