Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Commit

Permalink
Project skeleton.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianloveswords committed Oct 3, 2012
0 parents commit fde4b84
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
node_modules
4 changes: 4 additions & 0 deletions Makefile
@@ -0,0 +1,4 @@
server:
@node app.js

.PHONY: server
34 changes: 34 additions & 0 deletions app.js
@@ -0,0 +1,34 @@
var express = require('express');
var routes = require('./routes');
var user = require('./routes/user');
var http = require('http');
var path = require('path');
var nunjucks = require('nunjucks');

var app = express();

var env = new nunjucks.Environment(new nunjucks.FileSystemLoader('views'));
env.express(app);

app.configure(function() {
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
});

app.configure('development', function() {
app.use(express.errorHandler());
});

app.get('/', routes.index);
app.get('/users', user.list);

http.createServer(app).listen(app.get('port'), function() {
console.log("Express server listening on port " + app.get('port'));
});
13 changes: 13 additions & 0 deletions package.json
@@ -0,0 +1,13 @@
{
"name": "clothespin",
"description": "Makin' badges",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node app"
},
"dependencies": {
"express": "3.0.0rc5",
"nunjucks": "~0.1.3"
}
}
8 changes: 8 additions & 0 deletions public/stylesheets/style.css
@@ -0,0 +1,8 @@
body {
padding: 50px;
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
}

a {
color: #00B7FF;
}
8 changes: 8 additions & 0 deletions routes/index.js
@@ -0,0 +1,8 @@

/*
* GET home page.
*/

exports.index = function(req, res){
res.render('index.html', { title: 'Express' });
};
8 changes: 8 additions & 0 deletions routes/user.js
@@ -0,0 +1,8 @@

/*
* GET users listing.
*/

exports.list = function(req, res){
res.send("respond with a resource");
};
4 changes: 4 additions & 0 deletions views/index.html
@@ -0,0 +1,4 @@
{% extends "layout.html" %}
{% block content %}
<h1>Clothespin!</h1>
{% endblock %}
14 changes: 14 additions & 0 deletions views/layout.html
@@ -0,0 +1,14 @@
<!doctype html public "wutlol">
<html lang="en-us">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=Edge;chrome=1">

<title dir="ltr">Oh hey</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
{% block content %}{% endblock %}
</body>
</html>

0 comments on commit fde4b84

Please sign in to comment.