On Thu, 15 Aug 2013 14:20:40 GMT, Craig Dillabaugh wrote:
On Wed, 14 Aug 2013 22:13:11 GMT, Sönke Ludwig wrote:
On Wed, 14 Aug 2013 21:13:42 GMT, Craig Dillabaugh wrote:
I am brand new to D, and am trying out the REST API demo provided at:
https://github.com/rejectedsoftware/vibe.d/blob/master/examples/rest/source/app.d
The application compiles and runs, but when I attempt to execute a query against the API (as follows)
curl -X GET http://localhost:8080/some_info/
I get the following error:
(...)
The
Example1API
class uses the new@rootPathFromName
attribute, which adds a prefix for the API based on its name. In this case that would be "/example1api/" and the complete URL should be (untested) "http://localhost:8080/example1api/some_info/".You can also run the application with --vv (i.e. "dub -- -vv") to get a list of all registered routes printed - plus a lot of other, less useful, stuff.
This works. Thanks very much.
Craig
A comment about the API and this forum for anyone who may be viewing this through the web forum.
The path above should read "/example1_api/" (notice the underscore). It seems like the web forum strips out the underscore in the path name (although I see it when replying, since all the fancy formatting is omitted.)
Also, the "dub -- -vv" option was great. Would it be OK if I edited the example on GitHub to comment on runnign dub with this option, and on the impact of @rootPathFromName
.
Craig