[英]restify js default root page
我正在嘗試使用node.js restify編寫寧靜的應用程序。 這是我的應用程序的代碼:
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 http://localhost:3000/
上看到我的index.html頁面,但是現在我在那里收到了
{"code":"ResourceNotFound","message":"/"}
試試看:
server.get(/\//, restify.serveStatic({
directory: './content',
default: 'index.html'
}));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.