Skip to content

Как обработать динамические роуты с помощью стандартной библиотеки http в node.js? #64

Answered by tshemsedinov
AlexKharenko asked this question in Q&A
Discussion options

You must be logged in to vote
  1. You have a collection of routes Map<string, function>
  2. Parse by / and remove path sections while path not found. For example:
    • /api/chats/10 -> /api/chats - found
    • /api/localTime/China/Wuhan -> /api/localTime/China -> /api/localTime - found

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Dnkfff
Comment options

Answer selected by AlexKharenko
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants