Skip to content

Commit

Permalink
index&/adm/login views&routes
Browse files Browse the repository at this point in the history
  • Loading branch information
rainysun committed Dec 7, 2011
1 parent 14ee106 commit 519fbf9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
21 changes: 21 additions & 0 deletions config.js
@@ -0,0 +1,21 @@
var db_opt = {
host: 'localhost',
port: 3306,
user: 'root',
password: 'rainy',
database: 'library'
};

var mysql = new require('mysql'), db = null;
if(mysql.createClient){
db = mysql.createClient(db_opt);
}else{
db = new mysql.Client(db_opt);
db.connect(function(err){
if(err){
console.error("connect db " + db.host + " error: " + err);
process.exit();
}
});
}
exports.db = db;
7 changes: 7 additions & 0 deletions routes/adm.js
@@ -0,0 +1,7 @@
module.exports = function(app){
app.get('/adm/login', function(req, res){
res.render('login', {title: 'Library', layout: 'layout'});
});
app.post('/adm/login', function(req, res){
});
};
11 changes: 11 additions & 0 deletions views/login.jade
@@ -0,0 +1,11 @@
h1 Login
form(id='adm_login', method='post', action='/adm/login')
fieldset(id='inputs')
p
label(for='adm_id') ID:
input(id='adm_id', name='adm_id', type='text')
p
label(for='pwd') Password:
input(id='pwd', name='pwd', type='text')
p
input(type='submit', id='submit', value='Login')

0 comments on commit 519fbf9

Please sign in to comment.