- install yesod with
cabal install yesod-platform yesod-bin
- clone this repository with
git clone git@github.com:MaxDaten/ecom.git ecom
cd ecom
cabal install --only-dependencies
yesod devel
- visit
http://localhost:3000
this file is written in Markdown, a human readable markup language. See more here: Markdown Cheat Sheet
this project is generated by the command yesod init
and adopted by me (MaxDaten)
yesod is our framework of choiceand I recommend acid-state for the data-holding. so some basics about yesod first of all:
- you have install yesod with cabal, so you will have to install the haskell platform Haskell Platform or
just download ghc and compile the 'haskell platform' on your own (see FAQ 4) - remmeber to add
.cabal/bin
to your Path env - with a working haskell platform installation:
cabal install yesod-platform yesod-bin
- yesod-platform contains all the important core libs
- yesod-bin is just the executable to generate new projects and start the development server
We will use GIT
for the revision control. There are some differences to svn
. A good page to start with: Git Scm Book
- to start up just run
yesod devel
in the project root- this will (hopefully) run an development server on
http:\\localhost:3000
just browse to it an see further stuff [see FAQ 2.] - you can change the most of all source (
.hs
) and template files and the devel server will recompile this for you, you just have to reload your page, to see the result (i tend to implement an .js auto-reload script)
- this will (hopefully) run an development server on
mostly folderwise explanations:
/
(aka root): this is the folder this file lives withinecom.cabal
: haskell project definition (mostly generated by yesod).ghci
: language pragams for a ghci session.gitignore
: all mateched files will be ignored by git .gitignoredevel.hs
: yesod generated (just sligtly modified by MaxDaten)app
: the main wrapper of the Ecom libsrc
: added by me for the really important source files (it's a way better than dangling files in root (see a yesod init project)Ecom
Application
: just app creation and settings readingFoundations
: binding important yesod functions for operationImport
: general import filesModel
: here we will place (or rebind) our base data structures for acid-state and/or aeson for json parsingSettings
: settings handlingDevelopment
: ignore thisStaticFiles
: handling for static web files (images, not code generated css and so on)
Handler
*
here we will place all our web route definitions (RESTful style) with GET, POST and so on
static
: static files like images and css libs, we shouldn't care to much about ittemplate
: awesome shakespeare templates to generate annoying html, js, css files withtest
: just testing, i guess we will ignore this mostly ;)tools
: tools for cmd-line programs (ex. managment of persistence, import data-samples)messages
: just language translation support (wayne for us too)yesod-devel
,dist
,deploy
: just ignore thisconfig
: configuration files (see modules description forSettings
for differences to config files)facicon.ico
: if we want fancy, feel free to add a custom ico fileketer.yaml
: just deployment package descriptionrobots.txt
: just google it^^routes
: here you have to configure new url-routes for our web-appsettings.yml
: base settings for the web app
- conflicts with
cabal install yesod-platform
- call me (its resolvable but a bit tricky, we should solve this more directly)
- I can't reach the development server or I see a ugly page (css files are missing)
2. if you run the devel server not on your localhost, change the
config/settings.yml
settings to the LAN host (for me ex:approot: "http://192.168.178.200:3000"
) - How do I add routes?
- create a Handler in
src/Ecom.Handler
- import this Handler into the
Ecom.Application
module - add route definition in
config/routes
- add Module to cabal section
other-modules
- create a Handler in
- How can I build the haskell platform on my own (linux)
- download the latest Haskell Platform
tar.gz
and a prebuild ghc for your architecture (for haskell-platform 2013+ you will need ghc-7.6+) - unpack the ghc archive: ex.
tar -xvf ghc-7.6.3-x86_64-unknown-linux.tar.bz2
cd ghc-7.6.3
./configure && make install
the new ghc version is now installed (in/usr/local/bin
)
- unpack the haskell-platform archive
cd haskell-platform-2013.2.0.0
./configure && make
sudo make install
haskell platform is now installed
- download the latest Haskell Platform