diff --git a/src/routes/api/v1/channels.ts b/src/routes/api/v1/channels.ts index 916f2c1..0352c07 100644 --- a/src/routes/api/v1/channels.ts +++ b/src/routes/api/v1/channels.ts @@ -6,8 +6,6 @@ import { errors } from "../../../errors"; const router = express.Router(); -router.use(express.json()); - router.post( "/", authenticateRoute(), diff --git a/src/routes/api/v1/users.ts b/src/routes/api/v1/users.ts index 7cfdc73..7aa4dcb 100644 --- a/src/routes/api/v1/users.ts +++ b/src/routes/api/v1/users.ts @@ -7,8 +7,6 @@ import { authenticateRoute, signToken } from "../../../auth"; const router = express.Router(); -router.use(express.json()); - router.post( "/register", body("username").isLength({ min: 3, max: 32 }).isAlphanumeric("en-US", { ignore: " _-" }), diff --git a/src/server.ts b/src/server.ts index e55cea9..ac631c7 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,8 +1,9 @@ -import { Application } from "express"; +import { Application, json } from "express"; import usersRouter from "./routes/api/v1/users"; import channelsRouter from "./routes/api/v1/channels"; export default function(app: Application) { + app.use(json()); app.use("/api/v1/users", usersRouter); app.use("/api/v1/channels", channelsRouter); };