Permalink
Browse files

add examples

  • Loading branch information...
shaunlee committed May 4, 2011
1 parent 19cc1d8 commit 04c06cf4ca6ffe028d5f2454d6d5ee75bc47ee2c
Showing with 68 additions and 0 deletions.
  1. +44 −0 examples/app.js
  2. +8 −0 examples/public/stylesheets/style.css
  3. +1 −0 examples/views/_footer.jst
  4. +2 −0 examples/views/index.jst
  5. +13 −0 examples/views/layout.jst
View
@@ -0,0 +1,44 @@
+
+/**
+ * Module dependencies.
+ */
+
+var express = require('express');
+
+var app = module.exports = express.createServer();
+
+// Configuration
+
+app.configure(function(){
+ app.set('views', __dirname + '/views');
+ app.set('view engine', 'jst');
+ // Uncomment if you want to use .html instead of .jst'
+ // app.register('.html', require('jst'))
+ app.use(express.bodyParser());
+ app.use(express.methodOverride());
+ app.use(app.router);
+ app.use(express.static(__dirname + '/public'));
+});
+
+app.configure('development', function(){
+ app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
+});
+
+app.configure('production', function(){
+ app.use(express.errorHandler());
+});
+
+// Routes
+
+app.get('/', function(req, res){
+ res.render('index', {
+ title: 'Express'
+ });
+});
+
+// Only listen on $ node app.js
+
+if (!module.parent) {
+ app.listen(3000);
+ console.log("Express server listening on port %d", app.address().port);
+}
@@ -0,0 +1,8 @@
+body {
+ padding: 50px;
+ font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
+}
+
+a {
+ color: #00B7FF;
+}
@@ -0,0 +1 @@
+Template powered by node-jst.
View
@@ -0,0 +1,2 @@
+<h1>{{ title }}</h1>
+<p>Welcome to {{ title }}</p>
View
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>{{ title }}</title>
+ <link rel="stylesheet" href="/stylesheets/style.css">
+ </head>
+ <body>
+ {{ body }}
+
+ {{ partial('footer') }}
+ </body>
+</html>

0 comments on commit 04c06cf

Please sign in to comment.