deploy(
"default",
async (req, res) => {
const api_key = req.query.api_key;
if (req.url.startsWith("/d/")) {
var notebook = await metadata(req.url.substring(3), {
api_key
});
} else {
notebook = await metadata(req.url.substring(1), {
api_key
});
}
res.header("content-type", "text/html; charset=UTF-8");
res.header("cache-control", "private, max-age=10");
if (notebook === null) return res.status(404).send("Not found.");
res.header("id", notebook.id);
res.header("url", notebook.url);
res.header("login", /\(@([^)]+)\)/.exec(notebook.author)[1]);
res.send(
page({
notebookId: req.url,
api_key
})
);
},
{
modifiers: ["orchestrator"],
reusable: true
}
)