Form handling in Snap
In this recipe, we will look at how forms can be handled in the Snap Framework. We will also look at HTTP redirection and handling GET
and POST
methods.
How to do it...
- Create a new project,
form-handling-in-snap
, with thesimple
stack template:
stack --resolver lts-9.1 new form-handling-in-snap simple
- Add a dependency on the following libraries in the
build-depends
subsection of theexecutable
section, as follows:
executable form-handling-in-snap hs-source-dirs: src main-is: Main.hs default-language: Haskell2010 build-depends: base >= 4.7 && < 5 , snap-server , snap-core , snap , lens , bytestring , text , containers
Once the dependency is added, solve the dependency constraints by using the same resolver and allowing stack
to update the stack.yaml...