不好意思 我不是很懂 是要改甚麼下面是我的程式碼:
var mongodata=require('./monlistdata.js');
var msdata=require('./mslistdata.js');
var express=require("express");
var app=express();
//set view engine
app.set("view engine","jade")
//set view directory
app.set("views","MyViews")
app.get('/person',function(req,res){
mongodata.personList(function(recordset){
//console.log(recordset);
res.render('personPageTP', { personList:recordset });
});
});
app.get('/student',function(req,res){
msdata.stuList(function(recordset){
//console.log(recordset);
res.render('studentPageTP', { studentList:recordset });
});
});
var server=app.listen(3000,function(){
console.log('Server is running!');
});
加一段處理get / 的程式啦,像這樣:
...
app.get('/', function(req, res) {
res.render(...);
});
...
話說,你知道你程式在寫什麼嗎?不然你不應該不知道怎麼改才對。