subscan-explorer / subscan-essentials

Polkadot Substrate Explorer Subscan

Home Page:https://www.subscan.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue having multiple routes in 1 plugin

lukasrio opened this issue · comments

I have been trying to add more routes to the Router function into the router.Http{} of http.go file of plugins, in order to serve multiple endpoints from one plugin, such as:
func Router(s *service.Service) []router.Http {
svc = s
return []router.Http{
{"accounts", accounts},
{"account/address", accountdetails},
}
}

However this doesn't seem to work, the response for either endpoint is always that of the last function/endpoint (in this case func accountdetails. Response will be returned value of func accounts if I put that endpoint as the last one).

Is there any way to fix and enable the router to handle multiple endpoints?

Thanks
Lukas