0

使用lite-server (Angular2 docs) 我的 Angular 应用程序运行完美,但使用node-static手动导航不起作用。

例如,如果我使用lite-server手动编写localhost/404 ,我可以看到我的 404 页面,但如果我使用node-static为应用程序提供服务,我会得到一个空白页面。

控制台仍然是空的,所以我真的不明白原因。

这是我的节点静态服务器代码:

var nodeStatic = require('node-static');
var file = new nodeStatic.Server('wwwroot');

require('http').createServer(function (request, response) {
    request.addListener('end', function () {
        file.serve(request, response);
    }).resume();
}).listen(2035);

非常感谢!

4

1 回答 1

0

您需要使用重定向到入口点的服务器或使用LocationStrategy HashLocationStrategy默认的PathLocationStrategy.

于 2016-01-08T11:02:24.803 回答