Skip to content

igemuottawa/igem-bricklayer

Repository files navigation

iGEM Bricklayer

Layin ma bricks!

Note

The commands below are meant to be run in a terminal; which should be easy enough to access if you're using a mac or a linux distribution. Using Windows will be a little trickier. You'll have to install a terminal-like program. The Windows installer of Git comes with a terminal called git-bash. This should be enough to run these commands though you'll have to do some configuring so that the terminal is able to find the node program.

Alternatives:
  • Install Cygwin, another terminal like environment for windows.
  • Install Ubuntu, a linux distribution. Linux distributions are very programmer friendly and access to the terminal should be straightforward. You can choose to install it alongside you current operating system.
  • Get a mac.

First Run

If this is your first run of the server, we have to make sure the dependencies are installed:

  1. Install node.js! This will come with an executable called npm (Node Package Manager) that we'll use to install the dependencies.
  2. Install node-supervisor with the command npm install -g supervisor. This supervisor app will automatically restart the server whenever a file in the project changes. Makes developping a little smoother.
  3. If you're on Windows, install MSYS to a path without spaces. MSYS provides some unix tools like make and bash, which make development much easier. Make sure the MSYS tools are in your PATH. MSYS tools work with git.
  4. Make sure you're in the same directory as packages.json and run the command npm install. This will install dependencies like express (our webserver), jade (an html template language), etc. into our project in the node_modules folder.

Start App

To start the server run the command make go

Visit http://localhost:3000/ in your browser to see the app. See the Makefile to add more targets as you see fit.

Directory Structure

This should give an idea of how the code is structured.

  • app.js / app.coffee This file is where the application starts. It's at the root of the project. It's mostly generated by express but you can adjust it. I rewrote app.js in coffeescript which is why there's an app.coffee.
  • views/ This folder is where templates (html files) for pages should go. Express uses an HTML template language called Jade (jade-lang.org) which makes it easier to write HTML.
  • routes/ This folder holds code that handles HTTP requests (like GET and POST) that the server receives. For example if I'm in a browser and I'm on the website for our app and I wanna go to www.oursite.com/home/, the code that defines what's supposed to happen should be in this folder. home/ is called a route
  • services/ Code in here is meant to run on the server. It's where any application-specific logic should go, like primer calculations, xml parsing, melting temperature calculations, etc. Code in this folder is not sent to the client's browser. Most probably the code in here is used by the route handlers in the routes/ directory.
  • assets/ This folder holds files (like images, css stylesheets, and javascript files) that get sent to the client's browser. You can reference these files in the jade templates from the views/ folder.

Some stuff to Read