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,
      })
    );
  });
};
