我正在尝试使用node.js restify编写restful应用程序。下面是我的应用程序代码:
var restify = require('restify');
var server = restify.createServer();
server.get(/.*/, restify.serveStatic({
directory: 'content',
default: 'index.html'
}));
server.listen(3000, function() {
console.log('%s listening at %s', server.name, server.url);
});所以,我只能通过http://localhost:3000/index.html访问index.html。我还希望在根url http://localhost:3000/上看到我的index.html页面,但现在我在那里看到了
{"code":"ResourceNotFound","message":"/"}发布于 2014-12-19 06:18:13
试一试:
server.get(/\//, restify.serveStatic({
directory: './content',
default: 'index.html'
}));https://stackoverflow.com/questions/23314755
复制相似问题