Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to re-run the application #32

Open
Adi1505-macintosh opened this issue Mar 14, 2021 · 5 comments
Open

Not able to re-run the application #32

Adi1505-macintosh opened this issue Mar 14, 2021 · 5 comments

Comments

@Adi1505-macintosh
Copy link

Adi1505-macintosh commented Mar 14, 2021

After coding the first time, I was able to run the application and connect to database properly. However, after a week when I tried to start the serve (nodemon serve & npm start), I don't see the database connected or any sucessfull port connection. The UI is visible but trying to add users gives this issue:

[Error] Could not connect to the server.
[Error] XMLHttpRequest cannot load http://localhost:5000/users/add due to access control checks.
[Error] Failed to load resource: Could not connect to the server. (add, line 0)
[Error] Unhandled Promise Rejection: Error: Network Error
	(anonymous function) (0.chunk.js:954)
	promiseReactionJob

Same with adding exercise. No users visible. MongoDB shows that the relevant databases and records.

Any idea, what needs to be done while restarting the application on localhost?

@krukm
Copy link

krukm commented Mar 17, 2021

Did you start the server in a separate terminal tab? I had this issue too, but having two terminals solved the problem. One runs the server and the other your react page.

@Adi1505-macintosh
Copy link
Author

I did it on separate terminal tab but still not running. One is running nodemon server (backend) and the other one is npm start. Anything else one has to add?

@krukm
Copy link

krukm commented Mar 18, 2021

Did you add { useUnifiedTopology: true } to server.js mongoose.connect?

mongoose.connect(uri, { useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true }

@Adi1505-macintosh
Copy link
Author

Adi1505-macintosh commented Mar 19, 2021

Still gives the same error. The backend is connected (port and database). It seems to be a front-end issue.

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (add, line 0)
[Error] Unhandled Promise Rejection: Error: Request failed with status code 404
	(anonymous function) (vendors~main.chunk.js:1330)
	promiseReactionJob

@shenbao123
Copy link

shenbao123 commented Apr 19, 2021

Hi, I'm having the same issue, front uses port :3000 and backend uses port :5000.
Running both on different terminals gives me the status 404 error which does not let me fetch data from the server within the react app
What seems to be the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants