J
J
John2017-03-13 12:42:19
PHP
John, 2017-03-13 12:42:19

How to make a router with nested urls in php/nodejs?

How to make a router correctly so that the url is nested, and we do not know the amount of nesting.
You can do it like this (nodejs)

Route.get('/:category', 'FrontController.')
Route.get('/:category:subcategory', 'FrontController')
Route.get('/:category:subcategory:page', 'FrontController')

But this way we will limit our nesting to 3 resources,
Tell me how you do it. It doesn't matter what language, the main principle of work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2017-03-13
@Fragster

If we are talking about node + express, then there you can set regular expressions as the first parameter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question