Skip to content
Browse files

hotwired app.js to render the index template with jade

  • Loading branch information...
1 parent 6469e9f commit b0aa703c8f3fef44f16d2ea179c37011121e72d8 @tmay committed Apr 25, 2012
Showing with 23 additions and 24 deletions.
  1. +1 −2 .gitignore
  2. +10 −13 app.js
  3. +6 −9 views/index.jade
  4. +6 −0 views/layout.jade
View
3 .gitignore
@@ -11,5 +11,4 @@ pids
logs
results
-node_modules
-npm-debug.log
+npm-debug.log
View
23 app.js
@@ -3,21 +3,16 @@
* Module dependencies.
*/
-var express = require('express')
- , routes = require('./routes');
-
-var app = module.exports = express.createServer();
+var express = require('express');
+var app = express.createServer();
+var jade = require('jade');
+//var app = module.exports = express.createServer();
+app.register('.html', require('jade'));
// Configuration
-app.configure(function(){
- app.set('views', __dirname + '/views');
- app.set('view engine', '.');
- app.use(express.bodyParser());
- app.use(express.methodOverride());
- app.use(app.router);
- app.use(express.static(__dirname + '/public'));
-});
+app.use(express.static(__dirname + '/public'));
+app.use(express.bodyParser());
app.configure('development', function(){
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
@@ -29,7 +24,9 @@ app.configure('production', function(){
// Routes
-app.get('/', routes.index);
+app.get('/', function (req, res) {
+ res.render('index.jade', { title: 'Express' })
+});
app.listen(3000);
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
View
15 views/index.jade
@@ -1,9 +1,6 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title></title>
- </head>
- <body>
- <!-- Add your content here-->
- </body>
-</html>
+!!! 5
+html(lang="en")
+ head
+ body
+ #content
+ h1 this is some content to prove that it works
View
6 views/layout.jade
@@ -0,0 +1,6 @@
+!!!
+html
+ head
+ title= title
+ link(rel='stylesheet', href='/stylesheets/style.css')
+ body!= body

0 comments on commit b0aa703

Please sign in to comment.
Something went wrong with that request. Please try again.