Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static route depth #140

Closed
sorenmat opened this issue Aug 28, 2014 · 2 comments
Closed

Static route depth #140

sorenmat opened this issue Aug 28, 2014 · 2 comments

Comments

@sorenmat
Copy link

When trying to serve static assets like the one given in the example code. The path based approach doesn't seem to support any depth.
/static/index.html works but /static/js/main.js doesn't work.

@emicklei
Copy link
Owner

That depends on the Router used and the Route specification.

Using the default RouterJS311, you have to define multiple routes to the same handler function. Have a look at RegisterSwaggerService in the swagger package.

However, using the improved and recommended CurlyRouter, you can use a wildcard expression in the Route such as:

"/static/{subpath:*}"

And in your Route function:

subpath := r.PathParameter("subpath")

I will add an extra example in the project that demonstrates this.

Thank you for reporting this.

@sorenmat
Copy link
Author

Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants