admin管理员组文章数量:1357134
I have a web project that I deployed on Railway, but I’m facing an issue when trying to display a .ejs page. When I click on it, I get the error:
“404 NOT FOUND - Nginx/1.24.0”
I don’t know where the problem is.
The website works 100% fine locally, but this issue happens after deployment.
Is there a solution?
nodeServer/index.js
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, '../views'));
app.get('/ejs-page', (req, res) => {
sql = 'SELECT * FROM upvote ORDER BY id DESC';
con.query(sql, function(error,data){
if (error)
{
console.error("error fetching data:",error);
}
res.render('script', {title:'Mhaaaa application', action:'add', sampleData: data});
res.render('script', { action:'add', sampleData: data});
});
});
views/script.ejs
index.html
<div class ="button-container">
<button onclick="window.location.href='/ejs-page';" class="button">
# ***This button redirects me to an EJS page when I click it.***
<span class="text">vote</span>
</button>
本文标签: javascriptEJS Page Not Found (404) After Deploying on RailwayStack Overflow
版权声明:本文标题:javascript - EJS Page Not Found (404) After Deploying on Railway - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744067841a2585334.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论