Express and URL rewriting | HTML5 history

后端 未结 1 561
忘了有多久
忘了有多久 2021-01-06 14:19

I\'m trying to build a simple server to serve a single HTML page where all the logics are handled by Angular. As far as I\'m using the HTML5 history mode I\'m able to naviga

相关标签:
1条回答
  • 2021-01-06 14:36

    You need to set the root directory for relative filenames.

    app.all('/*', function(req, res) {
      res.sendfile('index.html', { root: __dirname+'/dist' });
    });
    
    0 讨论(0)
提交回复
热议问题