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

allow routes to operate on location hash #101

Closed
kingsleyh opened this issue Oct 21, 2018 · 5 comments
Closed

allow routes to operate on location hash #101

kingsleyh opened this issue Oct 21, 2018 · 5 comments

Comments

@kingsleyh
Copy link

At the moment I can't run Kemal and server the API and the Mint app from the same kemal instance. This means I have to run 2 servers and I can't make use of Kemals session handling and I have to enable cors.

Because the routes are in the url the Kemal server picks them up instead of the Mint app - In Elm it uses location hash for routing. Could we do the same thing - and optionally choose to use location hash as I think this would solve my issues running inside the same server.

@kingsleyh
Copy link
Author

I've found a workaround in Kemal which seems to work ok

  error 404 do |context|
    context.response.content_type = "text/html"
    context.response.status_code = 200
    File.read(File.join("public", "index.html"))
  end

it feels a bit wrong to use the error stuff though - it would be better if a custom handler or a middleware could do it instead

@gdotdesign
Copy link
Member

gdotdesign commented Oct 23, 2018

Would it be okay if this would be supported?

routes {
  /path# {
  }

  /path#:entity/:page (entity : String, page : String) {
  }
}

Edit: It's added in master ➡️ 9211065

@kingsleyh
Copy link
Author

I think kemal would still pick up the /path part first but I'm not sure - If it's in master I could try and see if it works

@gdotdesign
Copy link
Member

Should be fixed in 0.4.0 @kingsleyh can you validate it? Should I close this issue?

@kingsleyh
Copy link
Author

yup all good :)

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

No branches or pull requests

2 participants