Quick Start to Web App Development with the Snap Framework and OpenBSD

The Haskell based Snap Framework is now available via the OpenBSD ports tree.  If you enjoy writing your programs in Haskell, you now have a quick and convenient way to establish a base for web application development.  Follow these three simple steps to begin writing web applications and web services in Haskell.

First, install the Snap Framework package from your favorite mirror:

#> sudo pkg_add -vi hs-snap-server hs-heist hs-xhtml-combinators

real-world-haskell.jpg The first package, hs-snap-server, installs the server libraries for the Snap Framework and all the necessary dependencies.  The hs-heist and hs-xhtml-combinators packages are required for the skeleton web application that Snap will create for you.  Heist is a xhtml templating library.

Second, use the snap command to create a starter web application:

#> snap init my-web-application

Third, compile the web application from the "src" directory:

#> ghc -make Main

Now execute Main and point your web browser at port 8000.  You should be greeted with the response "hello world".  Give it a try.  I would like to know how it works for you.
comments powered by Disqus

Recent Entries

Traditional Data Backup and Clouds, They Don't Mix
People are enamored with "cloud computing" these days.  It's featured in TV commercials, vendor certifications, magazine articles, and industry analyst…
Quick Start to Web App Development with the Snap Framework and OpenBSD
The Haskell based Snap Framework is now available via the OpenBSD ports tree.  If you enjoy writing your programs in…
Three Steps to a Free Laptop Backup
I use Dropbox to maintain a near real-time backup of my important data.  You can too.  Here's how to get…