/ecom

project for ecommerce lecture

Primary LanguageJavaScript

💲 Ecom README

Quick Start

  • 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

Intro

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:

Basic Setup

Haskell Setup

  • 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

GIT

We will use GIT for the revision control. There are some differences to svn. A good page to start with: Git Scm Book

Development

  • 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)

Project Structure

mostly folderwise explanations:

  • / (aka root): this is the folder this file lives within
  • ecom.cabal : haskell project definition (mostly generated by yesod)
  • .ghci : language pragams for a ghci session
  • .gitignore : all mateched files will be ignored by git .gitignore
  • devel.hs : yesod generated (just sligtly modified by MaxDaten)
  • app : the main wrapper of the Ecom lib
  • src : 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 reading
      • Foundations : binding important yesod functions for operation
      • Import : general import files
      • Model : here we will place (or rebind) our base data structures for acid-state and/or aeson for json parsing
      • Settings : settings handling
        • Development : ignore this
        • StaticFiles : 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 it
  • template : awesome shakespeare templates to generate annoying html, js, css files with
  • test : 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 this
  • config : configuration files (see modules description for Settings for differences to config files)
    • facicon.ico : if we want fancy, feel free to add a custom ico file
    • keter.yaml : just deployment package description
    • robots.txt : just google it^^
    • routes : here you have to configure new url-routes for our web-app
    • settings.yml : base settings for the web app

FAQ

  1. conflicts with cabal install yesod-platform
    1. call me (its resolvable but a bit tricky, we should solve this more directly)
  2. 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")
  3. How do I add routes?
    1. create a Handler in src/Ecom.Handler
    2. import this Handler into the Ecom.Application module
    3. add route definition in config/routes
    4. add Module to cabal section other-modules
  4. How can I build the haskell platform on my own (linux)
    1. download the latest Haskell Platform tar.gz and a prebuild ghc for your architecture (for haskell-platform 2013+ you will need ghc-7.6+)
    2. unpack the ghc archive: ex. tar -xvf ghc-7.6.3-x86_64-unknown-linux.tar.bz2
      1. cd ghc-7.6.3
      2. ./configure && make install the new ghc version is now installed (in /usr/local/bin)
    3. unpack the haskell-platform archive
      1. cd haskell-platform-2013.2.0.0
      2. ./configure && make
      3. sudo make install haskell platform is now installed

Links