sandstorm-io/sandstorm

Update docs and examples to reflect that BridgeConfig.apiPath must end with /

Open

#3654 opened on Aug 1, 2022

View on GitHub
 (4 comments) (0 reactions) (0 assignees)JavaScript (6,583 stars) (737 forks)batch import
app-platformbuggood first issue

Description

I was creating a new python app using the diy stack and wanted to allow an HTTP API, but simply uncommenting the apiPath = "/api" in sandstorm-pkgdef.capnp didn't work for sub paths such as http://api-8a22a421a78b1ecbdf92b9a691b7ffda.local.sandstorm.io:6090/stuff

The grain log shows the resulting url to be /apistuff rather than /api/stuff: 127.0.0.1 - - [01/Aug/2022 01:48:18] "GET /apistuff HTTP/1.1" 202 9 and this is because according to sandstorm.io/sandstorm/src/sandstorm/package.capnp:218 the BridgeConfig.apiPath must end with "/".

So the documentation and many examples give "/api" as the example apiPath value, but it doesn't fit the requirements for that value. I searched across sandstorm repos for apiPath examples and it looks like many of them do not end with a /. See https://github.com/search?q=org%3Asandstorm-io+apipath&type=code .

Should all those examples and documentation be updated from "/api" to "/api/"? Are there any downsides to ending with a /? If your api doesn't use subpaths, then there may be no substantial difference between /api and /api/, except that the docs say it needs to end with /.

I believe updating the docs across the repos would be easy. Just use this search https://github.com/search?q=org%3Asandstorm-io+apipath&type=code and change all the examples that are wrong.

Contributor guide