效果演示
在example文件夹中,新建一个test_method文件夹,里面建立一个run.js文件,用来写逻辑代码。还要建立一个public目录,里面建立一个page.html。以下是测试的目录结构。

page.html 内容
<!doctype html> <html> <head> <title>test get/post method</title> </head> <body> <h4>test get method</h4> <a href="/gettest">test get</a> <h4>test post method.</h4> <form action="/posttest" method="post"> <input type="submit" value="test post"/> </form> </body> </html>
run.js 内容
var fk = require("../.."),
App = fk.App,
app = new App(),
static_middle = fk.static;
// 加载static中间件
app.use(static_middle(__dirname+"/public"));
app.get(function(req,res){
res.write("I am GET method result!");
res.end();
})
app.post(function(req,res){
res.write("I am POST method result!");
res.end();
})
app.listen(process.env.PORT);以下视频是演示效果:
下一节,是今天的收尾工作。会把stuwebfk代码发布到github和npmjs上去,并在github上发布0.0.2版本标签。