heshanindika / gorest

Automatically exported from code.google.com/p/gorest
0 stars 0 forks source link

Registering the gorest.Handle() in non '/' does not work. #18

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Register the "hello" service with http.Handle("/api", gorest.Handle()) where 
the entrypoint is not "/"
2. Try to access the webservice under "/api/hello/name"

What is the expected output? What do you see instead?
I expect the API to just work under a different entrypoint, but it always 
fails. This prevents me from using the same port for the website and the API 
serving.

Original issue reported on code.google.com by bart.meu...@gmail.com on 24 Apr 2014 at 12:42

GoogleCodeExporter commented 8 years ago
Nevermind, can be solved by using:

http.Handle("/api/" , http.StripPrefix("/api", gorest.Handle()))

Original comment by bart.meu...@gmail.com on 24 Apr 2014 at 2:13