gin dynamic router.POST("api/v1/:type", apiAction)
gin static route router.POST("api/v1/home", apiHome) router.POST("api/v1/login", apiLogin)
I used a dynamic route to deal with all the apis, the project is no problem, I want to ask is, dynamic routing in addition to a bit of performance loss, concurrency problems?
Comment From: yashisrani
@biancheng347 I think dynamic routing is generally safe and does not cause concurrency issues, but it can show slightly performance loss & can increase complexity while dubugging and maintaining handlers.
Comment From: Yatin-aggarwal
In dynamic routing there is a negligible performance loss in most cases, unless you have very high throughput. Also there is no inherent concurrency issues due to dynamic routes alone but you must ensure api handler thread safety. Only risk is if :type isn't strictly validated, attackers can access unintended routes, bypass specific security checks, and trigger sensitive or internal logic not meant for public use.