Dynamic routes #2180
Replies: 2 comments
-
Currently Echo router is not designed to be modified after server has started - you will have a datarace when new route is added at the same time as requests are served. and global variables are somewhat bad practice - you are making assumption that you have only single instance. There are plenty of cases when you would want multiple instances of similar things. For example spawn multiple Servers in same application runtime and different ports etc. |
Beta Was this translation helpful? Give feedback.
-
Oh, to clarify, the routes are added during application launch. Alternatively, would adding my API/function to check for existing keys or enforce paths to adopt Having used to the way of Nginx's reverse proxy approach for each application runtime, I'm quite curious which scenario we will need multiple servers in same application runtime and different ports? |
Beta Was this translation helpful? Give feedback.
-
I have some ideas on writing sub-module that will need to add new routes to echo e.g. like plug-ins.
Is it idea to declare echo route as global variable?
Beta Was this translation helpful? Give feedback.
All reactions