1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2024-09-21 04:57:29 +00:00
bibliogram/html/static/js/templates/api/templates.js
2020-01-13 01:50:21 +13:00

19 lines
457 B
JavaScript

const passthrough = require("../../../../../passthrough")
module.exports = [
{
route: "/api/templates", methods: ["GET"], code: async () => {
const result = {}
const entries = passthrough.instance.pugCache.entries()
for (const [file, value] of entries) {
const match = file.match(/client\/.*?([^/]+)\.pug$/)
if (match) {
const name = match[1]
result[name] = value.client.toString()
}
}
return [200, result]
}
}
]