Getting started with Snap
In this recipe, we will install Snap and create our first Snap application. The Snap Framework is not (yet) part of the official list of packages on Stackage. Hence, to get started with Snap, we will have to build the Snap Framework ourselves.
How to do it...
- Open a console, change the directory to the desired location, and clone the
snap-templates
framework, as follows:
git clone https://github.com/snapframework/snap-templates.git
- The
snap-templates
package does not have astack.yaml
file generated. Generate a new one.
stack --resolver lts-9.1 init --solver --ignore-subdirs
At the moment, lts-9.1
is the latest LTS available with stack
. We also need to ignore the subdirectories, as otherwise, stack
will include all the subdirectories and cabal files in the stack
project file.
- Build and install the project using the following commands:
stack build stack install
- The snap executable will be installed in the local bin folder. On Unix systems, this...