Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Checked all the examples

  • Loading branch information...
commit 8e12dd9c17506e914d22afa90f6832e465635c33 1 parent fee0f0d
@sakateka sakateka authored tj committed
View
8 examples/auth/app.js
@@ -2,10 +2,10 @@
* Module dependencies.
*/
-var express = require('../../lib/express')
+var express = require('../..')
, hash = require('./pass').hash;
-var app = module.exports = express();
+var app = express();
// config
@@ -78,7 +78,7 @@ app.get('/', function(req, res){
});
app.get('/restricted', restrict, function(req, res){
- res.send('Wahoo! restricted area');
+ res.send('Wahoo! restricted area, click to <a href="/logout">logout</a>');
});
app.get('/logout', function(req, res){
@@ -120,4 +120,4 @@ app.post('/login', function(req, res){
if (!module.parent) {
app.listen(3000);
console.log('Express started on port 3000');
-}
+}
View
21 examples/auth/views/layout.ejs
@@ -1,21 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>Authentication Example</title>
- <style>
- body {
- padding: 50px;
- font: 13px Helvetica, Arial, sans-serif;
- }
- .error {
- color: red
- }
- .success {
- color: green;
- }
- </style>
- </head>
- <body>
- <%- body %>
- </body>
-</html>
View
52 examples/auth/views/login.ejs
@@ -1,16 +1,36 @@
-<h1>Login</h1>
-<%- message %>
-Try accessing <a href="/restricted">/restricted</a>, then authenticate with "tj" and "foobar".
-<form method="post" action="/login">
- <p>
- <label>Username:</label>
- <input type="text" name="username">
- </p>
- <p>
- <label>Password:</label>
- <input type="text" name="password">
- </p>
- <p>
- <input type="submit" value="Login">
- </p>
-</form>
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Authentication Example</title>
+ <style>
+ body {
+ padding: 50px;
+ font: 13px Helvetica, Arial, sans-serif;
+ }
+ .error {
+ color: red
+ }
+ .success {
+ color: green;
+ }
+ </style>
+ </head>
+ <body>
+ <h1>Login</h1>
+ <%- message %>
+ Try accessing <a href="/restricted">/restricted</a>, then authenticate with "tj" and "foobar".
+ <form method="post" action="/login">
+ <p>
+ <label>Username:</label>
+ <input type="text" name="username">
+ </p>
+ <p>
+ <label>Password:</label>
+ <input type="text" name="password">
+ </p>
+ <p>
+ <input type="submit" value="Login">
+ </p>
+ </form>
+ </body>
+</html>
View
3  examples/jade/public/stylesheets/style.css
@@ -1,3 +1,4 @@
body {
padding: 50px 80px;
- font: 14px "Helvetica Nueue", "Lucida Grande", Arial, sans-serif;}
+ font: 14px "Helvetica Nueue", "Lucida Grande", Arial, sans-serif;
+}
View
4 examples/route-separation/index.js
@@ -11,7 +11,7 @@ var express = require('../..')
// Config
-app.set('view engine', 'ejs');
+app.set('view engine', 'jade');
app.set('views', __dirname + '/views');
app.use(express.cookieParser());
app.use(express.methodOverride());
@@ -35,4 +35,4 @@ app.put('/user/:id/edit', user.update);
app.get('/posts', post.list);
app.listen(3000);
-console.log('Express app started on port 3000');
+console.log('Express app started on port 3000');
View
4 examples/route-separation/views/index.ejs
@@ -1,4 +0,0 @@
-<ul>
- <li>Visit the <a href="/users">users</a> page</li>
- <li>Visit the <a href="/posts">posts</a> page</li>
-</ul>
View
6 examples/route-separation/views/index.jade
@@ -0,0 +1,6 @@
+extends layout
+
+block content
+ ul
+ li Visit the <a href="/users">users</a> page
+ li Visit the <a href="/posts">posts</a> page
View
9 examples/route-separation/views/layout.ejs
@@ -1,9 +0,0 @@
-<html>
- <head>
- <title><%= title %></title>
- <link href="/style.css" rel="stylesheet" />
- </head>
- <body>
- <%- body %>
- </body>
-</html>
View
6 examples/route-separation/views/layout.jade
@@ -0,0 +1,6 @@
+html
+ head
+ title= title
+ link(href="/style.css", rel="stylesheet")
+ body
+ block content
View
7 examples/route-separation/views/posts/index.ejs
@@ -1,7 +0,0 @@
-<h1>Posts</h1>
-<dl id="posts">
- <% posts.forEach(function(post){ %>
- <dt><%= post.title %></dt>
- <dd><%= post.body %></dd>
- <% }) %>
-</dl>
View
8 examples/route-separation/views/posts/index.jade
@@ -0,0 +1,8 @@
+extends ../layout
+
+block content
+ h1 Posts
+ dl#posts
+ for post in posts
+ dt= post.title
+ dd= post.body
View
9 examples/route-separation/views/users/edit.ejs
@@ -1,9 +0,0 @@
-<h1>Editing <%= user.name %></h1>
-<div id="user">
- <form method="post">
- <input type="hidden" value="put" name="_method" />
- <p>Name: <input type="text" value="<%= user.name %>" name="user[name]"/></p>
- <p>Email: <input type="text" value="<%= user.email %>" name="user[email]"/></p>
- <p><input type="submit" value="Save" /></p>
- </form>
-</div>
View
14 examples/route-separation/views/users/edit.jade
@@ -0,0 +1,14 @@
+extends ../layout
+
+block content
+
+ h1 Editing #{user.name}
+ #user
+ form(method="post")
+ input(type="hidden", value="put", name="_method")
+ p Name:
+ input(type="text", value= user.name, name="user[name]")
+ p Email:
+ input(type="text", value= user.email, name="user[email]")
+ p
+ input(type="submit", value="Save")
View
9 examples/route-separation/views/users/index.ejs
@@ -1,9 +0,0 @@
-<h1>Users</h1>
-<ul id="users">
- <% users.forEach(function(user, id){ %>
- <li>
- <a href="/user/<%= id %>"><%= user.name %></a>
- <a class="edit" href="/user/<%= id %>/edit">edit</a>
- </li>
- <% }) %>
-</ul>
View
9 examples/route-separation/views/users/index.jade
@@ -0,0 +1,9 @@
+extends ../layout
+
+block content
+ h1 Users
+ #users
+ for user, i in users
+ li
+ a(href="/user/#{i}")= user.name
+ a.edit(href="/user/#{i}/edit") edit
View
4 examples/route-separation/views/users/view.ejs
@@ -1,4 +0,0 @@
-<h1><%= user.name %></h1>
-<div id="user">
- <p>Email: <%= user.email %></p>
-</div>
View
6 examples/route-separation/views/users/view.jade
@@ -0,0 +1,6 @@
+extends ../layout
+
+block content
+ h1= user.name
+ #user
+ p Email: #{user.email}
View
6 examples/search/index.js
@@ -1,4 +1,8 @@
+// first:
+// $ npm install redis
+// $ redis-server
+
/**
* Module dependencies.
*/
@@ -54,4 +58,4 @@ app.get('/client.js', function(req, res){
});
app.listen(3000);
-console.log('app listening on port 3000');
+console.log('app listening on port 3000');
View
6 examples/session/index.js
@@ -1,4 +1,8 @@
+// first:
+// $ npm install redis
+// $ redis-server
+
var express = require('../..');
var app = express();
@@ -25,4 +29,4 @@ app.get('/', function(req, res){
});
app.listen(3000);
-console.log('Express app started on port 3000');
+console.log('Express app started on port 3000');
Please sign in to comment.
Something went wrong with that request. Please try again.