U
U
Urukhayy2017-11-25 09:42:04
Node.js
Urukhayy, 2017-11-25 09:42:04

Is this kind of route file acceptable?

For path: /books/232/pages

var express = require("express")
var controller = require("../../controllers/book")
var page = require("./page.js")
var router = express.Router()
var param = express.Router()

router.route("/")
    .get(controller.list)
    .post(controller.post)

router.param("name", controller.init)

param.use("/pages", page)

param.route("/")
    .get(controller.get)
    .delete(controller.delete)

router.use("/:name", param)

module.exports = router

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question