Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 48bae69b46
Fetching contributors…

Cannot retrieve contributors at this time

65 lines (45 sloc) 3.378 kb

THIS TUTORIAL IS STILL WORK IN PROGRESS

Welcome

Welcome curious stranger. You have wandered into tutorial which aims to help you grasp the Snap and Heist Haskell modules via building a simple dynamic website.

Prerequisites

Knowledge

Modules

Apart from the basic and standard modules, you will need these:

Take a look at the pastie.cabal for details

Tools

You only need a text editor or IDE of your choice, GHC and cabal (I would presonally recommend cabal-dev).

Design Decisions

In this littel project, we will be abiding the rules of what is usually called the MVC architecture. The reason is simple -- it makes your code more modular and thus hopefully easier to reason about and maintain.

Disclaimer: These design decisions are in no way related to the Snap & Heist itself, you do not have to follow them in your projects.

Model

Model should provide API to retrieve and store data (in our case in database).

Our model resides in the src/Model directory. It's job is:

  • to communicate with a database (i.e. writing and reading),
  • to present data in suitable form to the controller.

Controller

Controller is the place where the application logic resides.

Our controller resides in the src/Controller directory. It's job is:

  • to manipulate the data it got from the model and prepare them to be presented to the user (e.g. retrieve a post),
  • to convert the data it got from users to suitable form for the model (e.g. handle a form).

In Snap & Heist terms, this is the place where we implement most of our splices (ideally all of them).

View

View is the mediator between application and the user.

Our view resides in the resources/templates directory. It's job is:

  • to display the data from controller to the user,
  • to provide an input facilities (e.g. a HTML form).

In Snap & Heist terms, the view consists of the Heist templates where we call the controller's splices.

Down to Bussines

Setting up the MongoDB Extension

Jump to Line
Something went wrong with that request. Please try again.