Node.js 提供API和x2B;来自同一节点的网站工作不正常

Node.js 提供API和x2B;来自同一节点的网站工作不正常,node.js,api,static,Node.js,Api,Static,我从同一个nodejS脚本提供API调用和静态服务 router.get('/emailall/:crq/:emailtype/:custEmailSender/:singlemailbody/:subject', function(req, res) { API call in here }); router.get('/', function(req, res) { res.sendFile( path.join( __dirname, 'client', 'index.htm

我从同一个nodejS脚本提供API调用和静态服务

router.get('/emailall/:crq/:emailtype/:custEmailSender/:singlemailbody/:subject', function(req, res) {
    API call in here
});

router.get('/', function(req, res) {
  res.sendFile( path.join( __dirname, 'client', 'index.html' ));
});

app.use('/', router);
app.use( express.static( __dirname + '/client' ));
问题是,当我离开索引页()并刷新子页()时

它将其视为api调用,但失败:

无法获取/子页面