From 115210bfd9a5ae7bb8b516ce0d2cf3d9042dead7 Mon Sep 17 00:00:00 2001 From: Raphael Kabo Date: Fri, 6 Oct 2023 16:18:13 +0100 Subject: refactor: frontend routes into TS file, new event path --- src/app.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/app.ts') diff --git a/src/app.ts b/src/app.ts index 32e89b6..f49092c 100755 --- a/src/app.ts +++ b/src/app.ts @@ -1,7 +1,9 @@ import express from "express"; -import routes from "./routes.js"; import hbs from "express-handlebars"; +import routes from "./routes.js"; +import frontend from "./routes/frontend.js"; + const app = express(); // View engine // @@ -39,6 +41,7 @@ app.use(express.json({ type: "application/activity+json" })); // support json en app.use(express.urlencoded({ extended: true })); // Router // +app.use("/", frontend); app.use("/", routes); export default app; -- cgit v1.2.3 From 2996a4d05d0ea2f8446e2a2a0383979ceec748ae Mon Sep 17 00:00:00 2001 From: Raphael Kabo Date: Fri, 6 Oct 2023 16:25:29 +0100 Subject: Run Prettier on all files --- src/app.ts | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/app.ts') diff --git a/src/app.ts b/src/app.ts index f49092c..5b01b3c 100755 --- a/src/app.ts +++ b/src/app.ts @@ -8,26 +8,26 @@ const app = express(); // View engine // const hbsInstance = hbs.create({ - defaultLayout: "main", - partialsDir: ["views/partials/"], - layoutsDir: "views/layouts/", - helpers: { - plural: function (number: number, text: string) { - var singular = number === 1; - // If no text parameter was given, just return a conditional s. - if (typeof text !== "string") return singular ? "" : "s"; - // Split with regex into group1/group2 or group1(group3) - var match = text.match(/^([^()\/]+)(?:\/(.+))?(?:\((\w+)\))?/); - // If no match, just append a conditional s. - if (!match) return text + (singular ? "" : "s"); - // We have a good match, so fire away - return ( - (singular && match[1]) || // Singular case - match[2] || // Plural case: 'bagel/bagels' --> bagels - match[1] + (match[3] || "s") - ); // Plural case: 'bagel(s)' or 'bagel' --> bagels + defaultLayout: "main", + partialsDir: ["views/partials/"], + layoutsDir: "views/layouts/", + helpers: { + plural: function (number: number, text: string) { + var singular = number === 1; + // If no text parameter was given, just return a conditional s. + if (typeof text !== "string") return singular ? "" : "s"; + // Split with regex into group1/group2 or group1(group3) + var match = text.match(/^([^()\/]+)(?:\/(.+))?(?:\((\w+)\))?/); + // If no match, just append a conditional s. + if (!match) return text + (singular ? "" : "s"); + // We have a good match, so fire away + return ( + (singular && match[1]) || // Singular case + match[2] || // Plural case: 'bagel/bagels' --> bagels + match[1] + (match[3] || "s") + ); // Plural case: 'bagel(s)' or 'bagel' --> bagels + }, }, - }, }); app.engine("handlebars", hbsInstance.engine); app.set("view engine", "handlebars"); -- cgit v1.2.3