Javascript restify js默认根页面

Javascript restify js默认根页面,javascript,node.js,restify,Javascript,Node.js,Restify,我正在尝试使用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()

我正在尝试使用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
。 我还希望在根url上看到我的index.html页面,
http://localhost:3000/
但现在我收到了

{"code":"ResourceNotFound","message":"/"}
尝试一下:

server.get(/\//, restify.serveStatic({
    directory: './content',
    default: 'index.html'
 }));
尝试一下:

server.get(/\//, restify.serveStatic({
    directory: './content',
    default: 'index.html'
 }));

应该
server.get(/.*/
不是
server.get(/*
或类似的?点是什么?它是用来加工任何字符串的regexp。点意味着任何符号,星意味着它可以是任何数量的符号。啊,很好的功能-这有帮助吗?-关于
目录
-我能想到的唯一其他事情是我尝试过的-对我的问题没有帮助。我能够得到你的示例工作ing-你确定你有一个包含“index.html”文件的“content”目录吗?很好地验证了基本知识:)应该
server.get(/.*/
不是
server.get(/*
或类似的?点是什么?它是用来加工任何字符串的regexp。点意味着任何符号,星意味着它可以是任何数量的符号。啊,很好的功能-这有帮助吗?-关于
目录
-我能想到的唯一其他事情是我尝试过的-对我的问题没有帮助。我能够得到你的示例工作ing-您确定有一个包含“index.html”文件的“content”目录吗?很好地验证了基础知识:)