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

Wildcard routing #70

Closed
jasonrichardsmith opened this issue Mar 28, 2015 · 3 comments
Closed

Wildcard routing #70

jasonrichardsmith opened this issue Mar 28, 2015 · 3 comments
Labels

Comments

@jasonrichardsmith
Copy link

Hello,

I am porting an application where all traffic gets sent to the same index.html, regardless of path except the API endpoint. AngularJS is responsible for building the page. Go will work as the API that will tell Angular how the page is served.

http://mongular.org/

Essentially I need all traffic aside from anything under the 'foo.com/mongolar' (this is configurable) to be routed to one index.html.

I am having problem with the wildcard route. Is this doable with your router?

I am also serving some js and css as static files from their own folders.

@jasonrichardsmith
Copy link
Author

This is where I am at with the code at this point.
https://github.com/jasonrichardsmith/mongolar/blob/master/mongolar.go

@julienschmidt
Copy link
Owner

If I understand you correctly, you have something like the following structure:

/mongolar/... [a lot of API routes]
/css/*filepath
/js/*filepath
/index.html

I think there are two options:

  1. Use Router.NotFound handler to send everything to index.html when there is no defined route
  2. Use HttpRouter only for the API under /mongolar and use the default http.Mux for handling the css, js folders, as well as the dispatching to HttpRouter and sending all the rest to the index.html

@jasonrichardsmith
Copy link
Author

Yes, I see that now. Thank you!

similark pushed a commit to similarweb/httprouter that referenced this issue May 9, 2023
Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.17.2 to 0.20.4.
- [Release notes](https://github.com/kubernetes/api/releases)
- [Commits](kubernetes/api@v0.17.2...v0.20.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>
Co-authored-by: Aaron Schlesinger <aaron@ecomaz.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants