diff options
author | Raphael <mail@raphaelkabo.com> | 2023-10-08 19:26:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-08 19:26:04 +0100 |
commit | 44e150bc7f8391b56b78a0697dbd128a8bf8be7b (patch) | |
tree | ef065e69228453d5d49b886157a4a88ed3540474 /src/app.ts | |
parent | 9ef8e220b4fb582d620016d293b340a63ec97cff (diff) | |
parent | 608532d24d868d939fd2cef6302d8d5089a81ee4 (diff) |
Merge pull request #112 from lowercasename/rk/typescript
Typescript migration
Diffstat (limited to 'src/app.ts')
-rwxr-xr-x | src/app.ts | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -3,9 +3,16 @@ 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 group from "./routes/group.js"; + +import { initEmailService } from "./lib/email.js"; const app = express(); +app.locals.sendEmails = initEmailService(); + // View engine // const hbsInstance = hbs.create({ defaultLayout: "main", @@ -27,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); @@ -37,11 +47,16 @@ 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("/", group); app.use("/", routes); export default app; |