├── .gitignore ├── .travis.yml ├── README.md ├── app.js ├── bin └── www ├── package.json ├── public ├── fonts │ └── chunkfive │ │ ├── Chunkfive-webfont.eot │ │ ├── Chunkfive-webfont.svg │ │ ├── Chunkfive-webfont.ttf │ │ └── Chunkfive-webfont.woff └── stylesheets │ ├── chunkfive-fontface.css │ ├── mixins │ └── css3.styl │ ├── partials │ └── typography.styl │ ├── style.css │ └── style.styl ├── routes └── index.js ├── test └── app.test.js └── views ├── about.jade ├── contact.jade ├── error.jade ├── index.jade └── layout.jade /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .monitor 3 | nodemon-ignore 4 | node_modules 5 | *.swp 6 | 7 | 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.10' 4 | deploy: 5 | provider: heroku 6 | app: express-tutorial 7 | api_key: 8 | secure: TLcy5QZ3SimYNndcIcUXYGKgWBDOYdfx6T9erNVZtOAnGvHK1b0g4rJnCYr19N0m5aBKE3Pkteq8zz6hPq+VhtnJRnv5FJ+krBLz5nZkaPdjuHyh1909jXdqSCnB8fNU6tjVavnnJSO9KY3rRbSDarsMTLAhXcPOGjIpj15FkAE= 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Example Express Application 2 | 3 | [![Build Status](https://travis-ci.org/shapeshed/express_example.png?branch=master)](https://travis-ci.org/shapeshed/express_example) 4 | 5 | This is an example [express][4] application to accompany the article [Creating a basic site with node.js and Express][1]. The site is [hosted on Heroku][6]. 6 | 7 | The article covers starting an Express 3.x.x app and deploying it to [Heroku][3] 8 | 9 | There is a [further article][5] detailing how to continuously deploy Node.js applications using GitHub, Travis & Heroku. 10 | 11 | ![Express Example][2] 12 | 13 | 14 | [1]: http://shapeshed.com/creating-a-basic-site-with-node-and-express/ 15 | [2]: http://shapeshed.com/images/articles/express_example.jpg 16 | [3]: http://heroku.com 17 | [4]: http://expressjs.com/ 18 | [5]: http://shapeshed.com/continuously-deploy-node-apps-with-github-travis-and-heroku/ 19 | [6]: http://express-tutorial.herokuapp.com/ 20 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var path = require('path'); 3 | var favicon = require('serve-favicon'); 4 | var logger = require('morgan'); 5 | var cookieParser = require('cookie-parser'); 6 | var bodyParser = require('body-parser'); 7 | var routes = require('./routes/'); 8 | 9 | var app = express(); 10 | 11 | // view engine setup 12 | app.set('views', path.join(__dirname, 'views')); 13 | app.set('view engine', 'jade'); 14 | 15 | // uncomment after placing your favicon in /public 16 | //app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); 17 | app.use(logger('dev')); 18 | app.use(bodyParser.json()); 19 | app.use(bodyParser.urlencoded({ extended: false })); 20 | app.use(cookieParser()); 21 | app.use(require('stylus').middleware(path.join(__dirname, 'public'))); 22 | app.use(express.static(path.join(__dirname, 'public'))); 23 | app.use(routes); 24 | 25 | // catch 404 and forward to error handler 26 | app.use(function(req, res, next) { 27 | var err = new Error('Not Found'); 28 | err.status = 404; 29 | next(err); 30 | }); 31 | 32 | 33 | // error handlers 34 | 35 | // development error handler 36 | // will print stacktrace 37 | if (app.get('env') === 'development') { 38 | app.use(function(err, req, res, next) { 39 | res.status(err.status || 500); 40 | res.render('error', { 41 | message: err.message, 42 | error: err 43 | }); 44 | }); 45 | } 46 | 47 | // production error handler 48 | // no stacktraces leaked to user 49 | app.use(function(err, req, res, next) { 50 | res.status(err.status || 500); 51 | res.render('error', { 52 | message: err.message, 53 | error: {} 54 | }); 55 | }); 56 | 57 | module.exports = app; 58 | 59 | -------------------------------------------------------------------------------- /bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Module dependencies. 5 | */ 6 | 7 | var app = require('../app'); 8 | var debug = require('debug')('express_example:server'); 9 | var http = require('http'); 10 | 11 | /** 12 | * Get port from environment and store in Express. 13 | */ 14 | 15 | var port = normalizePort(process.env.PORT || '3000'); 16 | app.set('port', port); 17 | 18 | /** 19 | * Create HTTP server. 20 | */ 21 | 22 | var server = http.createServer(app); 23 | 24 | /** 25 | * Listen on provided port, on all network interfaces. 26 | */ 27 | 28 | server.listen(port); 29 | server.on('error', onError); 30 | server.on('listening', onListening); 31 | 32 | /** 33 | * Normalize a port into a number, string, or false. 34 | */ 35 | 36 | function normalizePort(val) { 37 | var port = parseInt(val, 10); 38 | 39 | if (isNaN(port)) { 40 | // named pipe 41 | return val; 42 | } 43 | 44 | if (port >= 0) { 45 | // port number 46 | return port; 47 | } 48 | 49 | return false; 50 | } 51 | 52 | /** 53 | * Event listener for HTTP server "error" event. 54 | */ 55 | 56 | function onError(error) { 57 | if (error.syscall !== 'listen') { 58 | throw error; 59 | } 60 | 61 | var bind = typeof port === 'string' 62 | ? 'Pipe ' + port 63 | : 'Port ' + port; 64 | 65 | // handle specific listen errors with friendly messages 66 | switch (error.code) { 67 | case 'EACCES': 68 | console.error(bind + ' requires elevated privileges'); 69 | process.exit(1); 70 | break; 71 | case 'EADDRINUSE': 72 | console.error(bind + ' is already in use'); 73 | process.exit(1); 74 | break; 75 | default: 76 | throw error; 77 | } 78 | } 79 | 80 | /** 81 | * Event listener for HTTP server "listening" event. 82 | */ 83 | 84 | function onListening() { 85 | var addr = server.address(); 86 | var bind = typeof addr === 'string' 87 | ? 'pipe ' + addr 88 | : 'port ' + addr.port; 89 | debug('Listening on ' + bind); 90 | } 91 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "express_example", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "body-parser": "1.15.1", 10 | "cookie-parser": "1.4.3", 11 | "debug": "2.2.0", 12 | "express": "4.13.4", 13 | "jade": "1.11.0", 14 | "morgan": "1.7.0", 15 | "serve-favicon": "2.3.0", 16 | "stylus": "0.54.5" 17 | }, 18 | "scripts": { 19 | "test": "./node_modules/mocha/bin/mocha", 20 | "start": "node ./bin/www" 21 | }, 22 | "devDependencies": { 23 | "mocha": "3.1.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /public/fonts/chunkfive/Chunkfive-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shapeshed/express_example/3de0ae190114ad8b42434170f57146ba9e700d32/public/fonts/chunkfive/Chunkfive-webfont.eot -------------------------------------------------------------------------------- /public/fonts/chunkfive/Chunkfive-webfont.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | This is a custom SVG webfont generated by Font Squirrel. 6 | Copyright : Generated in 2009 by FontLab Studio Copyright info pending 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /public/fonts/chunkfive/Chunkfive-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shapeshed/express_example/3de0ae190114ad8b42434170f57146ba9e700d32/public/fonts/chunkfive/Chunkfive-webfont.ttf -------------------------------------------------------------------------------- /public/fonts/chunkfive/Chunkfive-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shapeshed/express_example/3de0ae190114ad8b42434170f57146ba9e700d32/public/fonts/chunkfive/Chunkfive-webfont.woff -------------------------------------------------------------------------------- /public/stylesheets/chunkfive-fontface.css: -------------------------------------------------------------------------------- 1 | /* Generated by Font Squirrel (http://www.fontsquirrel.com) on April 17, 2011 03:57:00 AM America/New_York */ 2 | 3 | 4 | 5 | @font-face { 6 | font-family: 'ChunkFiveRegular'; 7 | src: url('/fonts/chunkfive/Chunkfive-webfont.eot'); 8 | src: url('/fonts/chunkfive/Chunkfive-webfont.eot?#iefix') format('eot'), 9 | url('/fonts/chunkfive/Chunkfive-webfont.woff') format('woff'), 10 | url('/fonts/chunkfive/Chunkfive-webfont.ttf') format('truetype'), 11 | url('/fonts/chunkfive/Chunkfive-webfont.svg#webfont90E2uSjN') format('svg'); 12 | font-weight: normal; 13 | font-style: normal; 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /public/stylesheets/mixins/css3.styl: -------------------------------------------------------------------------------- 1 | /* https://gist.github.com/895668 */ 2 | vendor(prop, args) 3 | -webkit-{prop} args 4 | -moz-{prop} args 5 | -o-{prop} args 6 | {prop} args 7 | 8 | animation() 9 | vendor('animation', arguments) 10 | 11 | border-radius() 12 | vendor('border-radius', arguments) 13 | 14 | border-top-radius() 15 | vendor('border-top-left-radius', arguments) 16 | vendor('border-top-right-radius', arguments) 17 | 18 | border-bottom-radius() 19 | vendor('border-bottom-left-radius', arguments) 20 | vendor('border-bottom-right-radius', arguments) 21 | 22 | linear-gradient(start_color, end_color, start = left top, end = left bottom) 23 | mozstart = top if start = left top 24 | background start_color 25 | background -moz-linear-gradient(mozstart, start_color 0%, end_color 100%) 26 | background -webkit-gradient(linear, start, end, color-stop(0%, start_color), color-stop(100%, end_color)) 27 | -webkit-background-origin padding-box 28 | 29 | background-clip() 30 | vendor('background-clip', arguments) 31 | 32 | box-shadow() 33 | -moz-box-shadow arguments 34 | -webkit-box-shadow arguments 35 | box-shadow arguments 36 | 37 | box(orient, pack, align) 38 | display -webkit-box 39 | display -moz-box 40 | display box 41 | vendor('box-orient', orient) 42 | vendor('box-pack', pack) 43 | vendor('box-align', align) 44 | vendor('box-lines', multiple) 45 | 46 | box_flex() 47 | vendor('box-flex', arguments) 48 | 49 | text-fill-color() 50 | vendor('text-fill-color', arguments) 51 | 52 | transition() 53 | vendor('transition', arguments) 54 | 55 | transform() 56 | vendor('transform', arguments) 57 | 58 | -------------------------------------------------------------------------------- /public/stylesheets/partials/typography.styl: -------------------------------------------------------------------------------- 1 | h1 2 | color #666 3 | font 4em 'ChunkFiveRegular' 4 | line-height 0.9em 5 | margin-bottom 0.9em 6 | 7 | h2 8 | font-size: 1.8em 9 | line-height 1em 10 | margin-bottom 1em 11 | 12 | h3 13 | font-size 1.6em 14 | line-height 1.13em 15 | margin-bottom 1.13em 16 | 17 | h4 18 | font-size 1.4em 19 | line-height 1.29em 20 | margin-bottom 1.29em 21 | 22 | h5 23 | font-size 1.3em 24 | line-height 1.38em 25 | margin-bottom 1.38em 26 | 27 | h6 28 | font-size 1.2em 29 | line-height 1.5em 30 | margin-bottom 1.5em 31 | 32 | p, q, cite, address, ul, ol, dl 33 | font-size 1.2em 34 | line-height 1.5em 35 | margin-bottom 1.5em 36 | 37 | li, dd, dt 38 | font-size 1em 39 | 40 | a 41 | text-decoration underline 42 | color #3333cc 43 | outline none 44 | 45 | a:hover 46 | text-decoration none 47 | 48 | code, samp, dfn, kbd, var, acronym, ins, del 49 | 50 | abbr 51 | speak spell-out 52 | 53 | acronym 54 | speak normal 55 | 56 | -------------------------------------------------------------------------------- /public/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | /* Reset 2 | Based on http://meyerweb.com/eric/thoughts/2008/01/15/resetting-again/ 3 | Removed elements not supported in HTML5 4 | -----------------------------------------------------------------------------*/ 5 | html, 6 | body, 7 | div, 8 | span, 9 | object, 10 | iframe, 11 | h1, 12 | h2, 13 | h3, 14 | h4, 15 | h5, 16 | h6, 17 | p, 18 | blockquote, 19 | pre, 20 | a, 21 | abbr, 22 | address, 23 | cite, 24 | code, 25 | del, 26 | dfn, 27 | em, 28 | img, 29 | ins, 30 | kbd, 31 | q, 32 | samp, 33 | small, 34 | strike, 35 | strong, 36 | sub, 37 | sup, 38 | var, 39 | b, 40 | i, 41 | dl, 42 | dt, 43 | dd, 44 | ol, 45 | ul, 46 | li, 47 | fieldset, 48 | form, 49 | label, 50 | legend, 51 | table, 52 | caption, 53 | tbody, 54 | tfoot, 55 | thead, 56 | tr, 57 | th, 58 | td { 59 | margin: 0; 60 | padding: 0; 61 | border: 0; 62 | outline: 0; 63 | font-size: 100%; 64 | vertical-align: baseline; 65 | } 66 | /* 67 | Trigger the new block level elements in to the correct content flow 68 | -----------------------------------------------------------------------------*/ 69 | article, 70 | aside, 71 | dialog, 72 | figure, 73 | footer, 74 | header, 75 | hgroup, 76 | menu, 77 | nav, 78 | section { 79 | display: block; 80 | } 81 | /* Set up document 82 | -----------------------------------------------------------------------------*/ 83 | body { 84 | font: 62.5%/1.5 Helvetica, Arial, "Lucida Grande", "Lucida Sans", Tahoma, Verdana, sans-serif; 85 | text-align: center; 86 | background: #000; 87 | } 88 | #wrapper { 89 | width: 920px; 90 | text-align: left; 91 | margin-left: auto; 92 | margin-right: auto; 93 | background: #fff; 94 | padding: 20px; 95 | -webkit-border-bottom-left-radius: 15px; 96 | -moz-border-bottom-left-radius: 15px; 97 | -o-border-bottom-left-radius: 15px; 98 | border-bottom-left-radius: 15px; 99 | -webkit-border-bottom-right-radius: 15px; 100 | -moz-border-bottom-right-radius: 15px; 101 | -o-border-bottom-right-radius: 15px; 102 | border-bottom-right-radius: 15px; 103 | } 104 | /* Typography 105 | -----------------------------------------------------------------------------*/ 106 | h1 { 107 | color: #666; 108 | font: 4em 'ChunkFiveRegular'; 109 | line-height: 0.9em; 110 | margin-bottom: 0.9em; 111 | } 112 | h2 { 113 | font-size: 1.8em; 114 | line-height: 1em; 115 | margin-bottom: 1em; 116 | } 117 | h3 { 118 | font-size: 1.6em; 119 | line-height: 1.13em; 120 | margin-bottom: 1.13em; 121 | } 122 | h4 { 123 | font-size: 1.4em; 124 | line-height: 1.29em; 125 | margin-bottom: 1.29em; 126 | } 127 | h5 { 128 | font-size: 1.3em; 129 | line-height: 1.38em; 130 | margin-bottom: 1.38em; 131 | } 132 | h6 { 133 | font-size: 1.2em; 134 | line-height: 1.5em; 135 | margin-bottom: 1.5em; 136 | } 137 | p, 138 | q, 139 | cite, 140 | address, 141 | ul, 142 | ol, 143 | dl { 144 | font-size: 1.2em; 145 | line-height: 1.5em; 146 | margin-bottom: 1.5em; 147 | } 148 | li, 149 | dd, 150 | dt { 151 | font-size: 1em; 152 | } 153 | a { 154 | text-decoration: underline; 155 | color: #33c; 156 | outline: none; 157 | } 158 | a:hover { 159 | text-decoration: none; 160 | } 161 | code, 162 | samp, 163 | dfn, 164 | kbd, 165 | var, 166 | acronym, 167 | ins, 168 | del, 169 | abbr { 170 | speak: spell-out; 171 | } 172 | acronym { 173 | speak: normal; 174 | } 175 | /* CSS Tables 176 | -----------------------------------------------------------------------------*/ 177 | .css-table { 178 | width: 100%; 179 | display: table; 180 | } 181 | .css-table .two-column { 182 | display: table-row; 183 | } 184 | .css-table .two-column .cell { 185 | display: table-cell; 186 | vertical-align: top; 187 | width: 50%; 188 | } 189 | .css-table .two-column .cell * { 190 | width: 90%; 191 | } 192 | .css-table .three-column { 193 | display: table-row; 194 | } 195 | .css-table .three-column .cell { 196 | display: table-cell; 197 | width: 33.33333%; 198 | } 199 | .css-table .three-column .cell * { 200 | width: 90%; 201 | } 202 | .css-table .four-column { 203 | display: table-row; 204 | } 205 | .css-table .four-column .cell { 206 | display: table-cell; 207 | width: 25%; 208 | } 209 | /* Header 210 | -----------------------------------------------------------------------------*/ 211 | header { 212 | background: #f00060; 213 | } 214 | header nav { 215 | width: 960px; 216 | text-align: right; 217 | margin-left: auto; 218 | margin-right: auto; 219 | } 220 | header nav ul { 221 | list-style: none; 222 | padding: 10px; 223 | margin-bottom: 0; 224 | } 225 | header nav ul li { 226 | display: inline; 227 | margin-left: 1%; 228 | } 229 | header nav ul li a { 230 | background: #fc9200; 231 | -webkit-border-radius: 15px; 232 | -moz-border-radius: 15px; 233 | -o-border-radius: 15px; 234 | border-radius: 15px; 235 | display: inline-block; 236 | padding: 5px 15px 6px; 237 | color: #fff; 238 | text-decoration: none; 239 | position: relative; 240 | cursor: pointer; 241 | } 242 | header nav ul li a:hover { 243 | background-color: #db0d5f; 244 | } 245 | /* Footer 246 | -----------------------------------------------------------------------------*/ 247 | footer { 248 | color: #666; 249 | border-top: 1px solid #ccc; 250 | padding-top: 1.5em; 251 | } 252 | footer ul { 253 | list-style: none; 254 | } 255 | -------------------------------------------------------------------------------- /public/stylesheets/style.styl: -------------------------------------------------------------------------------- 1 | @import "mixins/css3" 2 | /* Reset 3 | Based on http://meyerweb.com/eric/thoughts/2008/01/15/resetting-again/ 4 | Removed elements not supported in HTML5 5 | -----------------------------------------------------------------------------*/ 6 | html, body, div, span, object, iframe, 7 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 8 | a, abbr, address, cite, code, 9 | del, dfn, em, img, ins, kbd, q, samp, 10 | small, strike, strong, sub, sup, var, 11 | b, i, 12 | dl, dt, dd, ol, ul, li, 13 | fieldset, form, label, legend, 14 | table, caption, tbody, tfoot, thead, tr, th, td 15 | margin 0 16 | padding 0 17 | border 0 18 | outline 0 19 | font-size 100% 20 | vertical-align baseline 21 | 22 | /* 23 | Trigger the new block level elements in to the correct content flow 24 | -----------------------------------------------------------------------------*/ 25 | article, aside, dialog, figure, 26 | footer, header, hgroup, menu, 27 | nav, section 28 | display block 29 | 30 | 31 | /* Set up document 32 | -----------------------------------------------------------------------------*/ 33 | body 34 | font 62.5%/1.5 Helvetica, Arial, "Lucida Grande", "Lucida Sans", Tahoma, Verdana, sans-serif 35 | text-align center 36 | background #000 37 | 38 | #wrapper 39 | width 920px 40 | text-align left 41 | margin-left auto 42 | margin-right auto 43 | background #fff 44 | padding 20px 45 | border-bottom-radius(15px) 46 | 47 | /* Typography 48 | -----------------------------------------------------------------------------*/ 49 | h1 50 | color #666 51 | font 4em 'ChunkFiveRegular' 52 | line-height 0.9em 53 | margin-bottom 0.9em 54 | 55 | h2 56 | font-size: 1.8em 57 | line-height 1em 58 | margin-bottom 1em 59 | 60 | h3 61 | font-size 1.6em 62 | line-height 1.13em 63 | margin-bottom 1.13em 64 | 65 | h4 66 | font-size 1.4em 67 | line-height 1.29em 68 | margin-bottom 1.29em 69 | 70 | h5 71 | font-size 1.3em 72 | line-height 1.38em 73 | margin-bottom 1.38em 74 | 75 | h6 76 | font-size 1.2em 77 | line-height 1.5em 78 | margin-bottom 1.5em 79 | 80 | p, q, cite, address, ul, ol, dl 81 | font-size 1.2em 82 | line-height 1.5em 83 | margin-bottom 1.5em 84 | 85 | li, dd, dt 86 | font-size 1em 87 | 88 | a 89 | text-decoration underline 90 | color #3333cc 91 | outline none 92 | 93 | a:hover 94 | text-decoration none 95 | 96 | code, samp, dfn, kbd, var, acronym, ins, del 97 | 98 | abbr 99 | speak spell-out 100 | 101 | acronym 102 | speak normal 103 | 104 | 105 | /* CSS Tables 106 | -----------------------------------------------------------------------------*/ 107 | .css-table 108 | width 100% 109 | display table 110 | .two-column 111 | display table-row 112 | .cell 113 | display table-cell 114 | vertical-align top 115 | width 50% 116 | * 117 | width 90% 118 | .three-column 119 | display table-row 120 | .cell 121 | display table-cell 122 | width 33.33333% 123 | * 124 | width 90% 125 | .four-column 126 | display table-row 127 | .cell 128 | display table-cell 129 | width 25% 130 | 131 | /* Header 132 | -----------------------------------------------------------------------------*/ 133 | header 134 | background #F00060 135 | nav 136 | width 960px 137 | text-align right 138 | margin-left auto 139 | margin-right auto 140 | ul 141 | list-style none 142 | padding 10px 143 | margin-bottom 0 144 | li 145 | display inline 146 | margin-left 1% 147 | a 148 | background #fc9200 149 | border-radius(15px) 150 | display inline-block 151 | padding 5px 15px 6px 152 | color #fff 153 | text-decoration none 154 | position relative 155 | cursor pointer 156 | &:hover 157 | background-color #db0d5f 158 | 159 | /* Footer 160 | -----------------------------------------------------------------------------*/ 161 | footer 162 | color #666 163 | border-top 1px solid #ccc 164 | padding-top 1.5em 165 | ul 166 | list-style none 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /routes/index.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | 4 | router.get('/', function(req, res){ 5 | res.render('index', { 6 | title: 'Home' 7 | }); 8 | }); 9 | 10 | router.get('/about', function(req, res){ 11 | res.render('about', { 12 | title: 'About' 13 | }); 14 | }); 15 | 16 | router.get('/contact', function(req, res){ 17 | res.render('contact', { 18 | title: 'Contact' 19 | }); 20 | }); 21 | 22 | module.exports = router; 23 | 24 | -------------------------------------------------------------------------------- /test/app.test.js: -------------------------------------------------------------------------------- 1 | var app = require('../app'), 2 | assert = require('assert'), 3 | http = require('http'); 4 | 5 | describe('GET /', function(){ 6 | before(function() { 7 | var port = '3000'; 8 | app.set('port', port); 9 | var server = http.createServer(app); 10 | server.listen(port); 11 | }); 12 | 13 | it('should return a 200 status code', function (done){ 14 | http.get({ host: '0.0.0.0', port: 3000 }, function(res) { 15 | assert.deepEqual(res.statusCode, 200); 16 | done(); 17 | }).on('error', function(e) { 18 | throw new Error(e); 19 | }); 20 | }); 21 | 22 | }); 23 | -------------------------------------------------------------------------------- /views/about.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | h1 Aliquam erat volutpat. Donec in nulla a neque ornare pulvinar. Maecenas augue eros, bibendum ut egestas ac, tristique et neque. 5 | section.css-table 6 | section.two-column 7 | section.cell 8 | h2 Donec imperdiet 9 | p Lorem ipsum dolar sit amet, cons incidunt ut labore et dolore magn trud exercitation ullamcorpor susc vel eum irure dolor in reprehende dolore eu fugiat nulla pariatur. 10 | p At lupatum delenit aigue duos dolor tempor sunt in culpa qui officia d dereud facils est er expedit distinc peccand quaerer en imigent cupidat. Incita visset, accom ex robore ad quam vis vadisen vlavis confecs nis revinc tae. Ietm hae magnitu dine for super oper mari aggere. Oppidi his mowni bus suifs fortunis desp erate coe magno recipei ban ibi se rursus isdem opport unitel rursus isdem opport loci defen porti busi. Navigandi ad nunc. Que neque pedibus ipsorum, naves ad hunc mod arm aeque, erant fere situs oppi dorum ut facilus. Vada ac desussum aestus exipe aditurn habere ex alto. 11 | section.cell 12 | h2 Nunc sodales 13 | p Lorem ipsum dolar sit amet, cons incidunt ut labore et dolore magn trud exercitation ullamcorpor susc vel eum irure dolor in reprehende dolore eu fugiat nulla pariatur. 14 | p At lupatum delenit aigue duos dolor tempor sunt in culpa qui officia d dereud facils est er expedit distinc peccand quaerer en imigent cupidat. Incita visset, accom ex robore ad quam vis vadisen vlavis confecs nis revinc tae. Ietm hae magnitu dine for super oper mari aggere. Oppidi his mowni bus suifs fortunis desp erate coe magno recipei ban ibi se rursus isdem opport unitel rursus isdem opport loci defen porti busi. Navigandi ad nunc. Que neque pedibus ipsorum, naves ad hunc mod arm aeque, erant fere situs oppi dorum ut facilus. Vada ac desussum aestus exipe aditurn habere ex alto. 15 | section.css-table 16 | section.three-column 17 | section.cell 18 | h3 Etiam lobortis 19 | p Lorem ipsum dolar sit amet, cons incidunt ut labore et dolore magn trud exercitation ullamcorpor susc vel eum irure dolor in reprehende dolore eu fugiat nulla pariatur. 20 | section.cell 21 | h3 Phasellus lacus 22 | p Lorem ipsum dolar sit amet, cons incidunt ut labore et dolore magn trud exercitation ullamcorpor susc vel eum irure dolor in reprehende dolore eu fugiat nulla pariatur. 23 | section.cell 24 | h3 Aliquam vulputate 25 | p Lorem ipsum dolar sit amet, cons incidunt ut labore et dolore magn trud exercitation ullamcorpor susc vel eum irure dolor in reprehende dolore eu fugiat nulla pariatur. 26 | -------------------------------------------------------------------------------- /views/contact.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | h1 Sed non accumsan tortor. In hac habitasse platea dictumst. Sed dolor lectus, posuere eu pulvinar sed, vehicula et magna. 5 | section.css-table 6 | section.two-column 7 | section.cell 8 | h2 Donec imperdiet 9 | p Lorem ipsum dolar sit amet, cons incidunt ut labore et dolore magn trud exercitation ullamcorpor susc vel eum irure dolor in reprehende dolore eu fugiat nulla pariatur. 10 | p At lupatum delenit aigue duos dolor tempor sunt in culpa qui officia d dereud facils est er expedit distinc peccand quaerer en imigent cupidat. Incita visset, accom ex robore ad quam vis vadisen vlavis confecs nis revinc tae. Ietm hae magnitu dine for super oper mari aggere. Oppidi his mowni bus suifs fortunis desp erate coe magno recipei ban ibi se rursus isdem opport unitel rursus isdem opport loci defen porti busi. Navigandi ad nunc. Que neque pedibus ipsorum, naves ad hunc mod arm aeque, erant fere situs oppi dorum ut facilus. Vada ac desussum aestus exipe aditurn habere ex alto. 11 | section.cell 12 | h2 Nunc sodales 13 | p Lorem ipsum dolar sit amet, cons incidunt ut labore et dolore magn trud exercitation ullamcorpor susc vel eum irure dolor in reprehende dolore eu fugiat nulla pariatur. 14 | p At lupatum delenit aigue duos dolor tempor sunt in culpa qui officia d dereud facils est er expedit distinc peccand quaerer en imigent cupidat. Incita visset, accom ex robore ad quam vis vadisen vlavis confecs nis revinc tae. Ietm hae magnitu dine for super oper mari aggere. Oppidi his mowni bus suifs fortunis desp erate coe magno recipei ban ibi se rursus isdem opport unitel rursus isdem opport loci defen porti busi. Navigandi ad nunc. Que neque pedibus ipsorum, naves ad hunc mod arm aeque, erant fere situs oppi dorum ut facilus. Vada ac desussum aestus exipe aditurn habere ex alto. 15 | section.css-table 16 | section.three-column 17 | section.cell 18 | h3 Etiam lobortis 19 | p Lorem ipsum dolar sit amet, cons incidunt ut labore et dolore magn trud exercitation ullamcorpor susc vel eum irure dolor in reprehende dolore eu fugiat nulla pariatur. 20 | section.cell 21 | h3 Phasellus lacus 22 | p Lorem ipsum dolar sit amet, cons incidunt ut labore et dolore magn trud exercitation ullamcorpor susc vel eum irure dolor in reprehende dolore eu fugiat nulla pariatur. 23 | section.cell 24 | h3 Aliquam vulputate 25 | p Lorem ipsum dolar sit amet, cons incidunt ut labore et dolore magn trud exercitation ullamcorpor susc vel eum irure dolor in reprehende dolore eu fugiat nulla pariatur. 26 | -------------------------------------------------------------------------------- /views/error.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | h1= message 5 | h2= error.status 6 | pre #{error.stack} 7 | -------------------------------------------------------------------------------- /views/index.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | h1 Morbi elementum, sapien sit amet vehicula tincidunt, lorem purus vehicula purus, ut tempor libero sem at orci. 5 | section.css-table 6 | section.two-column 7 | section.cell 8 | h2 Donec imperdiet 9 | p Lorem ipsum dolar sit amet, cons incidunt ut labore et dolore magn trud exercitation ullamcorpor susc vel eum irure dolor in reprehende dolore eu fugiat nulla pariatur. 10 | p At lupatum delenit aigue duos dolor tempor sunt in culpa qui officia d dereud facils est er expedit distinc peccand quaerer en imigent cupidat. Incita visset, accom ex robore ad quam vis vadisen vlavis confecs nis revinc tae. Ietm hae magnitu dine for super oper mari aggere. Oppidi his mowni bus suifs fortunis desp erate coe magno recipei ban ibi se rursus isdem opport unitel rursus isdem opport loci defen porti busi. Navigandi ad nunc. Que neque pedibus ipsorum, naves ad hunc mod arm aeque, erant fere situs oppi dorum ut facilus. Vada ac desussum aestus exipe aditurn habere ex alto. 11 | section.cell 12 | h2 Nunc sodales 13 | p Lorem ipsum dolar sit amet, cons incidunt ut labore et dolore magn trud exercitation ullamcorpor susc vel eum irure dolor in reprehende dolore eu fugiat nulla pariatur. 14 | p At lupatum delenit aigue duos dolor tempor sunt in culpa qui officia d dereud facils est er expedit distinc peccand quaerer en imigent cupidat. Incita visset, accom ex robore ad quam vis vadisen vlavis confecs nis revinc tae. Ietm hae magnitu dine for super oper mari aggere. Oppidi his mowni bus suifs fortunis desp erate coe magno recipei ban ibi se rursus isdem opport unitel rursus isdem opport loci defen porti busi. Navigandi ad nunc. Que neque pedibus ipsorum, naves ad hunc mod arm aeque, erant fere situs oppi dorum ut facilus. Vada ac desussum aestus exipe aditurn habere ex alto. 15 | section.css-table 16 | section.three-column 17 | section.cell 18 | h3 Etiam lobortis 19 | p Lorem ipsum dolar sit amet, cons incidunt ut labore et dolore magn trud exercitation ullamcorpor susc vel eum irure dolor in reprehende dolore eu fugiat nulla pariatur. 20 | section.cell 21 | h3 Phasellus lacus 22 | p Lorem ipsum dolar sit amet, cons incidunt ut labore et dolore magn trud exercitation ullamcorpor susc vel eum irure dolor in reprehende dolore eu fugiat nulla pariatur. 23 | section.cell 24 | h3 Aliquam vulputate 25 | p Lorem ipsum dolar sit amet, cons incidunt ut labore et dolore magn trud exercitation ullamcorpor susc vel eum irure dolor in reprehende dolore eu fugiat nulla pariatur. 26 | -------------------------------------------------------------------------------- /views/layout.jade: -------------------------------------------------------------------------------- 1 | doctype 2 | html 3 | head 4 | title= title 5 | link(rel='stylesheet', href='/stylesheets/style.css') 6 | link(rel='stylesheet', href='/stylesheets/chunkfive-fontface.css') 7 | body 8 | header 9 | nav 10 | ul 11 | li 12 | a(href="/") Home 13 | li 14 | a(href="/about") About 15 | li 16 | a(href="/contact") Contact 17 | section#wrapper 18 | block content 19 | footer 20 | section.css-table 21 | section.four-column 22 | section.cell 23 | p Mauris porttitor
felis eu leo aliquet
ac rutrum odio aliquet 24 | section.cell 25 | p Mauris porttitor
felis eu leo aliquet
ac rutrum odio aliquet 26 | section.cell 27 | p Mauris porttitor
felis eu leo aliquet
ac rutrum odio aliquet 28 | section.cell 29 | p Mauris porttitor
felis eu leo aliquet
ac rutrum odio aliquet 30 | --------------------------------------------------------------------------------