Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Using serveDirectory can break routing #125

Closed
zopa opened this Issue · 0 comments

2 participants

Benjamin Doyle Gregory Collins
Benjamin Doyle

Using snap init barebones and this route table:

route [ ("article",      serveDirectory "resources/static")
      , ("article/:id",  writeBS "Why am I here?")
      ]

a request for "/article" returns "Why am I here?", rather than the expected contents of "resources/static/index.html".

Snap, given a call to serveDirectory, appends a trailing slash to the url and then appears to double back through the route table with the new URL; on the second pass "/article/" matches "/article/:id". This is strange: when I route a request to a handler I expect it to stay there, absent an explicit transfer of control.

Replacing serveDirectory "resources/static" with writeBS "index" outputs "index", as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.