Skip to content

Commit

Permalink
(index & adm/login)'s views & router
Browse files Browse the repository at this point in the history
  • Loading branch information
rainysun committed Dec 7, 2011
1 parent 933f2ed commit 14ee106
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 12 deletions.
7 changes: 5 additions & 2 deletions app.js
Expand Up @@ -4,7 +4,6 @@
*/

var express = require('express')
, routes = require('./routes')

var app = module.exports = express.createServer();

Expand All @@ -17,6 +16,9 @@ app.configure(function(){
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(__dirname + '/public'));
//session & cookie
app.use(express.cookieParser());
app.use(express.session({secret: 'rainy'}));
});

app.configure('development', function(){
Expand All @@ -29,7 +31,8 @@ app.configure('production', function(){

// Routes

app.get('/', routes.index);
require('./routes/index')(app);
require('./routes/adm')(app);

app.listen(3000);
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
2 changes: 1 addition & 1 deletion public/stylesheets/style.css
Expand Up @@ -5,4 +5,4 @@ body {

a {
color: #00B7FF;
}
}
13 changes: 5 additions & 8 deletions routes/index.js
@@ -1,8 +1,5 @@

/*
* GET home page.
*/

exports.index = function(req, res){
res.render('index', { title: 'Express' })
};
module.exports = function(app){
app.get('/', function(req, res){
res.render('index', {title: 'Library', layout: 'layout'});
});
};
31 changes: 30 additions & 1 deletion views/index.jade
@@ -1,2 +1,31 @@
h1= title
p Welcome to #{title}
a(href='/adm/login') Adm login
form(id='base_search', method='post', action='/base_search')
fieldset(id='inputs')
p
label(for='title') Title:
input(id='title', name='title', type='text')
p
label(for='category') Category:
input(id='category', name='category', type='text')
p
label(for='press') Press:
input(id='press', name='press', type='text')
p
label(for='year0') Start Year:
input(id='year0', name='year0', type='text')
label(for='year1') End Year:
input(id='year1', name='year1', type='text')
p
label(for='author') Author:
input(id='author', name='author', type='text')
p
label Order By:
select(name='order')
option(value='title') Title
option(value='category') Category
option(value='press') Press
option(value='year') Year
option(value='author') Author
p
input(id='submit', type='submit', value='Search')

0 comments on commit 14ee106

Please sign in to comment.