refactor: use .hbs extension

This commit is contained in:
Axel Cocat 2022-03-05 15:45:16 +01:00
parent ab5dcd3640
commit 28432b6523
11 changed files with 9 additions and 9 deletions

View file

@ -80,11 +80,11 @@ export class Armory {
app.locals.websiteName = this.config.websiteName;
app.locals.iframeMode = this.config.iframeMode;
app.engine(".html", handlebarsEngine({
extname: "html",
app.engine(".hbs", handlebarsEngine({
extname: "hbs",
partialsDir: path.join(process.cwd(), "static", "partials"),
layoutsDir: path.join(process.cwd(), "static"),
defaultLayout: "layout.html",
defaultLayout: "layout.hbs",
helpers: {
...require("handlebars-helpers")(),
},
@ -139,7 +139,7 @@ export class Armory {
status = err;
}
res.status(status).render("error.html", this.getErrorViewData(status, req));
res.status(status).render("error.hbs", this.getErrorViewData(status, req));
});
app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
@ -148,7 +148,7 @@ export class Armory {
// Respond with html page
if (req.accepts("html")) {
return res.render("error.html", this.getErrorViewData(404, req));
return res.render("error.hbs", this.getErrorViewData(404, req));
}
// Respond with json

View file

@ -176,7 +176,7 @@ export class CharacterController {
});
const mounts = await this.getMounts(realmName, charData.guid);
res.render("character.html", {
res.render("character.hbs", {
title: `Armory - ${charName}`,
...this.makeSharedDataObject(realm, charData),
data: JSON.stringify({
@ -210,7 +210,7 @@ export class CharacterController {
return next(404);
}
res.render("character-talents.html", {
res.render("character-talents.hbs", {
title: `Armory - ${charName} - Talents`,
...this.makeSharedDataObject(realm, charData),
data: JSON.stringify({
@ -237,7 +237,7 @@ export class CharacterController {
return next(404);
}
res.render("character-achievements.html", {
res.render("character-achievements.hbs", {
title: `Armory - ${charName} - Achievements`,
...this.makeSharedDataObject(realm, charData),
});

View file

@ -38,7 +38,7 @@ export class IndexController {
}
public async index(req: express.Request, res: express.Response): Promise<void> {
res.render("index.html", {
res.render("index.hbs", {
title: "Armory",
realms: this.armory.config.realms.map(r => r.name),
});