From b795d07ed7a1b705b72b171f8e8de267a720223b Mon Sep 17 00:00:00 2001 From: Raphael Kabo Date: Sat, 7 Oct 2023 14:30:24 +0100 Subject: refactor: event form and api routes --- src/app.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/app.ts') diff --git a/src/app.ts b/src/app.ts index 5b01b3c..30cf02d 100755 --- a/src/app.ts +++ b/src/app.ts @@ -3,9 +3,15 @@ import hbs from "express-handlebars"; import routes from "./routes.js"; import frontend from "./routes/frontend.js"; +import activitypub from "./routes/activitypub.js"; +import event from "./routes/event.js"; + +import { initEmailService } from "./lib/email.js"; const app = express(); +app.locals.sendEmails = initEmailService(); + // View engine // const hbsInstance = hbs.create({ defaultLayout: "main", @@ -37,11 +43,15 @@ app.set("hbsInstance", hbsInstance); app.use(express.static("public")); // Body parser // -app.use(express.json({ type: "application/activity+json" })); // support json encoded bodies +app.use(express.json({ type: "application/activity+json" })); +app.use(express.json({ type: "application/ld+json" })); +app.use(express.json({ type: "application/json" })); app.use(express.urlencoded({ extended: true })); // Router // app.use("/", frontend); +app.use("/", activitypub); +app.use("/", event); app.use("/", routes); export default app; -- cgit v1.2.3 From 6b220e094f215c488eb5102e25506f5b3d371245 Mon Sep 17 00:00:00 2001 From: Raphael Kabo Date: Sun, 8 Oct 2023 12:11:36 +0100 Subject: Refactor: event group form and API, extract JS --- src/app.ts | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/app.ts') diff --git a/src/app.ts b/src/app.ts index 30cf02d..c43f31d 100755 --- a/src/app.ts +++ b/src/app.ts @@ -5,6 +5,7 @@ import routes from "./routes.js"; import frontend from "./routes/frontend.js"; import activitypub from "./routes/activitypub.js"; import event from "./routes/event.js"; +import group from "./routes/group.js"; import { initEmailService } from "./lib/email.js"; @@ -33,6 +34,9 @@ const hbsInstance = hbs.create({ match[1] + (match[3] || "s") ); // Plural case: 'bagel(s)' or 'bagel' --> bagels }, + json: function (context: any) { + return JSON.stringify(context); + }, }, }); app.engine("handlebars", hbsInstance.engine); @@ -52,6 +56,7 @@ app.use(express.urlencoded({ extended: true })); app.use("/", frontend); app.use("/", activitypub); app.use("/", event); +app.use("/", group); app.use("/", routes); export default app; -- cgit v1.2.3