OpenAuth_server/FrontendLegacy/index.js
Fabian Stamm 0453e461c9 Restructuring the Project
Updating dependencies
2023-04-07 19:54:47 +02:00

21 lines
565 B
JavaScript

const handlebars = require("handlebars");
const { readFileSync } = require("fs");
const path = require("path");
const CACHE = {};
function get_template(name, dev) {
if (!dev && CACHE[name]) return CACHE[name];
const template = handlebars.compile(
readFileSync(path.join(__dirname, `./out/${name}/${name}.html`), "utf8")
);
CACHE[name] = template;
return template;
}
exports.register = (dev) => get_template("register", dev);
exports.admin = (dev) => get_template("admin", dev);
exports.authorize = (dev) => get_template("authorize", dev);