Serve Angular2 application

303 Views Asked by At

using lite-server (Angular2 docs) my angular application runs perfectly but using node-static the manual navigation does not work.

For example if I manually write localhost/404 using lite-server I can see my 404 page, but if I serve the application using node-static I get a blank page.

The console remains empty, so I really don't understand the cause.

This is my node-static server code:

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);

Thanks a lot!

1

There are 1 best solutions below

0
Günter Zöchbauer On

You need either to use a server that redirects to the entry point or use LocationStrategy HashLocationStrategy instead of the default PathLocationStrategy.