concatRoutes
Takes an array of route maps and attaches them to a root map as branches
Arguments
Name
Type
Description
root
Map
The root Map we want to attach our branch to
routes
Map[]
An array of route Maps we want to attach to the root
Usage
The below main
constant now represents /home
, /home/account
, and /home/dashboard
const { methods, router } = require('octoris')
const home = router.route([router.fixed('home')], [
methods.GET(homeHandler),
methods.POST(homeHandler)
])
const account = router.route([router.fixed('account')], [
methods.GET(accHandler)
])
const dash = router.route([router.fixed('dashboard')], [
methods.GET(dashHandler)
])
const main = router.concatRoutes(home, [account, dash])
Last updated
Was this helpful?