Express.js is a web server framework for node.js.
It has a tool to generate the skeleton of a web app (directory structure and an app.js file)
Based on that I added some stuff to serve as a basis for the app. The app is deployable with this code.
Here's a quick overview of the directory structure; ask me if something doesn't make sense!
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 obviously 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
assets/
This folder holds files (like images, css stylesheets, and javascript files) that get sent to the client. You can reference these files in the jade templates from the views/ folder.
I wrote in coffeescript because it's clean, and less verbose than javascript. If you prefer to write javascript then the great thing is that it will still work no problem.
Express.js is a web server framework for node.js. It has a tool to generate the skeleton of a web app (directory structure and an app.js file)
Based on that I added some stuff to serve as a basis for the app. The app is deployable with this code. Here's a quick overview of the directory structure; ask me if something doesn't make sense!
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 obviously 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 towww.oursite.com/home/
, the code that defines what's supposed to happen should be in this folder.home/
is called a routeassets/
This folder holds files (like images, css stylesheets, and javascript files) that get sent to the client. You can reference these files in the jade templates from theviews/
folder.I wrote in coffeescript because it's clean, and less verbose than javascript. If you prefer to write javascript then the great thing is that it will still work no problem.
See the README.md file on this branch for more information. https://github.com/krutkay/igem-bricklayer/tree/base-app