0
私はSEOのためAngular JSアプリでhtml5モードを使用しようとしています。しかし、私はindex.htmlを要求するエクスプレスの問題に直面しました。ディープリンクは機能せず、ページをリフレッシュできません。Angular html5モードからのエクスプレス提供index.htmlは機能しません
App.js
app.use(serveStatic(path.join(__dirname, 'public')));
app.use(serveStatic(path.join(__dirname, 'node_modules')));
app.use(serveStatic(path.join(__dirname, 'app_client')));
app.use('/api', routesApi);
app.all('/*', function(req, res, next) {
res.sendFile('./app_client/index.html', { root: __dirname });
console.log("send index");
});
私はすでにアプローチ、多くのソースから多くの研究をしてみてくださいなど
app.get('/', function(req, res) {
res.sendFile('index.html');
});
または
router.get('/', function(req, res) {
res.sendFile(path.join(__dirname, 'app_client', 'index.html'));
});
または
app.get('/*', function(req, res) {
res.sendFile(__dirname + '/index.html')
});
どれも動作していないようです。自分のコードで何かが間違っていなければならないことは知っていますが、私はどこにいるのか分かりません。