From cb2c2f244f67f24141c28003197481a73f07d8a5 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Mon, 14 Aug 2023 23:35:14 +1000 Subject: mmm bodyparser --- src/activitypub/Server.ts | 10 +++++++++- src/activitypub/routes/channel/#channel_id/inbox.ts | 9 +++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/activitypub/routes/channel/#channel_id/inbox.ts (limited to 'src') diff --git a/src/activitypub/Server.ts b/src/activitypub/Server.ts index 373d7390..84f842e0 100644 --- a/src/activitypub/Server.ts +++ b/src/activitypub/Server.ts @@ -5,6 +5,7 @@ import { initDatabase, registerRoutes, } from "@spacebar/util"; +import bodyParser from "body-parser"; import { Request, Response, Router } from "express"; import { Server, ServerOptions } from "lambert-server"; import path from "path"; @@ -27,7 +28,14 @@ export class APServer extends Server { this.app.set("json replacer", JSONReplacer); this.app.use(CORS); - this.app.use(BodyParser({ inflate: true, limit: "10mb" })); + this.app.use( + BodyParser({ + inflate: true, + limit: "10mb", + type: "application/activity+json", + }), + ); + this.app.use(bodyParser.urlencoded({ extended: true })); const api = Router(); const app = this.app; diff --git a/src/activitypub/routes/channel/#channel_id/inbox.ts b/src/activitypub/routes/channel/#channel_id/inbox.ts new file mode 100644 index 00000000..01e267e7 --- /dev/null +++ b/src/activitypub/routes/channel/#channel_id/inbox.ts @@ -0,0 +1,9 @@ +import { route } from "@spacebar/api"; +import { Router } from "express"; + +const router = Router(); +export default router; + +router.post("/", route({}), async (req, res) => { + console.log(req.body); +}); -- cgit 1.5.1