Как обработать динамические роуты с помощью стандартной библиотеки http в node.js? #64
-
Хочу спросить как можно обработать динамические роуты с использованием дефолтной http библиотеки? Столкнулся с проблемой обработки роута: /chats/:id . Спасибо. https://github.com/AlexKharenko/ChatApp/blob/development/ChatBack/src/controllers/chat.controller.js |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
Beta Was this translation helpful? Give feedback.
-
Here you have a structure: https://github.com/AlexKharenko/ChatApp/blob/development/ChatBack/src/controllers/chat.controller.js |
Beta Was this translation helpful? Give feedback.
-
Here are more ideas how to do it in a rps way rather then rest way: https://github.com/HowProgrammingWorks/NodejsStarterKit |
Beta Was this translation helpful? Give feedback.
/
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