purescript-contrib/purescript-routing

Parsing query params

Closed this issue · 1 comments

coot commented
parse "user/10/?a=1"

will parse with three RoutePart's

Path "user" : Path "10" : Query ... : Nil

But

parse "user/10?a=1"

will parse with two parts:

Path "user" : Path "10?a=1" : Nil

This is a bit unexpected.

coot commented

A solution would be to split using a regex:

import Data.String.Regex as R
import Data.String.Regex.Flags as R
R.split (unsafePartial fromRight $ R.regex "\\/|(?=\\?)" R.noFlags) hash

instead of using S.split (S.Pattern "/") hash