1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-22 02:12:40 +01:00

mmm bodyparser

This commit is contained in:
Madeline 2023-08-14 23:35:14 +10:00
parent 093c23feae
commit cb2c2f244f
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47
2 changed files with 18 additions and 1 deletions

View File

@ -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;

View File

@ -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);
});