使用Pushstate和NodeJS

我正在使用NodeJS和HTML5 pushstate。 我有我的index.html在“/”与链接去“/ home /”通过pushstate。 所有没关系,但如果我刷新/ home /,我的服务器返回“无法GET / home /”。

我只想“/ home /”返回我的index.html文件,如“/”

我的代码:

var express = require("express"), app = express(); app.use(express.static(__dirname + '/public')); app.get('/home/', function(req, res, next) { //what to do here? }); app.listen(3001); 

谢谢。

放下/之后/home

 app.get('/home', function(req, res, next) { 

关于在what to do here ,你可以收集你需要的数据,并返回响应。 例如: res.end("Hello world!");

如果你想把静态文件放在/home ,那么:

 app.use("/home", express.static(__dirname + "/public"));