Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
steven777400
@steven777400
I have a question about wai-routes, but I don't think it qualifies as an issue. I'm not sure if this is an ok place to ask questions or if it will even be seen... But if so, what I'm trying to do is host a wai routed application in a subdirectory (say /test/example.fcgi with URLs like /text/example.fcgi/w1/w2) where w1/w2 are the wai routes. It runs fine but when asking showRouteSub for the url I get just /w1/w2. I figure I need to use something like the Wai.Middleware.Approot but I'm not sure how to integrate that into the wai routes in the correct way.
Anupam Jain
@ajnsit
Hi, the behaviour looks correct. Since you are running the app as a cgi application, the path information received by the application would not include the path of the CGI executable itself.
I don't know the specifics of what you are trying to do, but using any middleware should be pretty easy.
When you are composing your app (i.e. where you have the code 'route <MasterDatatype>') simply add the line 'middleware (approotMiddleware <your approute function>)'
Anupam Jain
@ajnsit
the same for any other middleware, for example if you wish to hardcode the approute - 'middleware (harcoded "<your custom approute>")'
From within the handler, you can access the raw request with 'request' (not the most creative name I know). And then do whatever with it. So for example, get the approot with something like - 'request >>= getApproot'
Anupam Jain
@ajnsit
Also, feel free to open github issues even when you are not sure if the problem at hand is a wai-routes issue. I am still trying out the gitter chat thing and am not sure how well it works.
steven777400
@steven777400
OK that's what i did, thanks. Just wasn't sure if i was missing a better/more correct way. Thanks again.
Anupam Jain
@ajnsit
Sure, glad to be of help!