Getting Started With Snap (and User Authentication): Part 1
Before we get started, there is a quickstart on the snap-framework site
here that goes into the
scaffold project a bit. This course will go a little more in depth into the
default project, exploring user authentication.
If you wish to use hsenv, you can run this on newer versions:
or download the package for ghc-7.6.3 here and run this:
From here on out the process is the same if you’re using hsenv or not. Create a new directory named “abc” and enter it. This will also function as the name of our project and executable.
mkdir abccd abc
It’s good to update the package list when starting a new project:
cabal updatecabal install cabal-install
After updating and installing the new version of cabal-instal we can install snap:
cabal install snap
At this point we will have the
snap CLI and can run init to scaffold a default
project. After scaffolding, we then run
cabal install to compile the binary
abc to run the project.
abc will also take a port as such:
abc -p 8000
snap initcabal installabc -p 8000
Our app, abc, should now be running. Navigate to
localhost:8000 (or the port
you specified) in your browser to take a look.
In the next post we’ll take a look at the code we generated and take a brief overview of what it does.