Skip to content
Myr

Updated connect submodule

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parents a9db47f, b856a72 · Browse files · 9 files+280 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

9 files+280 added−0 removed

  • other:+280 added−0 removed

9 files+280 added−0 removed

added:examples/blog/models/post.js+56 added
added:examples/blog/public/style.css+40 added
added:examples/blog/routes/post.js+77 added
added:examples/blog/routes/site.js+17 added
added:examples/blog/views/post/form.jade+18 added
12- if (post.title)3 h1 Editing #{post.title}4- else5 h1 New Post67form#post(action='/post' + (post.title ? '/' + post.id : ''), method='post')8 - if (post.title)9 input(type='hidden', name='_method', value='put')10 p11 label(for='post[title]') Title:12 input(type='text', name='post[title]', value=post.title)13 p14 label(for='post[body]') Body:15 textarea(name='post[body]')= post.body || ''16 p17 input(type='submit', value=post.title ? 'Update' : 'Create')18
added:examples/blog/views/post/index.jade+13 added
1.post2 // title3 h24 = post.title5 a.edit(href='/post/' + post.id + '/edit') Edit6 7 // dates8 p.date.created Created at #{post.createdAt}9 - if (post.updatedAt)10 p.date.updated Updated at #{post.updatedAt}11 12 // body13 pre.body= post.body
added:examples/blog/views/index.jade+17 added
1h1 Blog23- if (count)4 p Display all #{count} post(s)5 #posts!= partial('post', posts)6- else7 p 8 | It looks like you have no posts!9 p10 | Click11 a(href='/post/add') here12 | to create a post. Login13 | as14 em "admin"15 | and16 em "express"17 | .
added:examples/blog/views/layout.jade+7 added
1!!! 52html3 head4 title Blog5 link(rel='stylesheet', href='/style.css')6 body7 #container!= body
added:examples/blog/app.js+35 added
12// Expose modules in ./support for demo purposes3require.paths.unshift(__dirname + '/../../support');45/**6 * Module dependencies.7 */89var express = require('../../lib/express');1011app = express.createServer();1213// Config1415app.set('views', __dirname + '/views');16app.set('view engine', 'jade');1718// Middleware1920app.configure(function(){21 app.use(express.logger('\x1b[33m:method\x1b[0m \x1b[32m:url\x1b[0m :response-time'));22 app.use(express.bodyDecoder());23 app.use(express.methodOverride());24 app.use(app.router);25 app.use(express.staticProvider(__dirname + '/public'));26 app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));27});2829// Routes3031require('./routes/site');32require('./routes/post');3334app.listen(3000);35console.log('Express started on port 3000');