[英]React nodejs web app not getting /pages on Heroku server
I am facing some problem in my web app on heroku. 我在heroku上的网络应用程序中遇到了一些问题。
I'm unable to GET /pages eg. 我无法获取/ pages例如。 /signin or /signup while running on heroku.
在heroku上运行时的/ signin或/ signup。
Here is my code on github. 这是我在github上的代码。 https://github.com/tanmoysarkar/shoppingApp.git
https://github.com/tanmoysarkar/shoppingApp.git
Here is my link for heroku. 这是我的heroku链接。 https://reactshoppingapp.herokuapp.com/
https://reactshoppingapp.herokuapp.com/
Its getting error canot GET /signin etc. 它的错误无法取消GET / signin等。
Any help would be very much needed on this issue. 在这个问题上非常需要任何帮助。
Anyone can please help me to solve this error. 任何人都可以帮助我解决此错误。
If I am right , you want to have a different url for login and signup as belows https://reactshoppingapp.herokuapp.com/signin 如果我是对的,您希望使用其他网址登录和注册,如下所示https://reactshoppingapp.herokuapp.com/signin
https://reactshoppingapp.herokuapp.com/signup . https://reactshoppingapp.herokuapp.com/signup 。
To achive this you will have to add 2 more paths(GET) in your server.js which will serve these pagesfor signin and signup ... 为此,您必须在server.js中添加2个以上的路径(GET),这些路径将用于登录和注册这些页面。
app.get('/signup', function (req, res) {
res.sendFile(path.join(__dirname, 'public/signup.html'));
});
app.get('/signin', function (req, res) {
res.sendFile(path.join(__dirname, 'public/views/signin.html'));
//signin.html is located in public/views/..
});
Note* : This is given that you have signup.html and login.html pages in your project in your public folder. 注意*:这是因为您的公用文件夹中的项目中有signup.html和login.html页面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.