pointsight/routes/index.route.js

37 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2022-03-06 18:36:36 +01:00
module.exports = function (app, metaGlobals, fontawesomeKey, mapboxAccessToken, config) {
const fs = require("fs");
const Eta = require("eta");
app.get("/", (req, res) => {
const data = fs.readFileSync("templates/index.eta.html", "utf8");
let indev = false;
if(config.ENV == "dev"){
indev = true
}
const errorPageContents = fs.readFileSync("templates/error/jserror.eta.html", "utf8").replace(new RegExp('\r?\n','g'), '<br />');
res.send(
Eta.render(data, {
desc: metaGlobals.desc,
siteTitel: metaGlobals.titlePrefx + "Map",
fontawesomeKey: fontawesomeKey,
mapboxAccessToken: mapboxAccessToken,
hereKey: config.here,
isInDev: indev,
errorPageContent: errorPageContents,
dsn: config.sentryDsn,
})
);
});
app.get("/about", (req, res) => {
const data = fs.readFileSync("templates/credits.eta.html", "utf8");
res.send(
Eta.render(data, {
desc: metaGlobals.desc,
siteTitel: metaGlobals.titlePrefx + "About",
fontawesomeKey: fontawesomeKey,
})
);
});
};