move json middleware use call into server object
This commit is contained in:
parent
144a46fa3c
commit
2956bf10fc
3 changed files with 2 additions and 5 deletions
|
@ -6,8 +6,6 @@ import { errors } from "../../../errors";
|
|||
|
||||
const router = express.Router();
|
||||
|
||||
router.use(express.json());
|
||||
|
||||
router.post(
|
||||
"/",
|
||||
authenticateRoute(),
|
||||
|
|
|
@ -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: " _-" }),
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue