tackling route params

  • This is really nice that it’s a lot like express
    • We can add route parameters with :xxx in the url, just like Sinatra and express. To read it in our handler, we use the param function. Edit the /hello route to be this
get "/hello/:name" $ do
    name <- param "name"
    text ("hello " <> name <> "!")
  • Tried this, got some errors. realized that Haskell has a ton of ideas about strings. Like Text.

Text errors

Text is defined in Data.Text.Internal
          Data.Text.Internal.Lazy.Text
            is defined in Data.Text.Internal.Lazy

Resources

Follow