Unable to connect backend postgres to frontend Vue

Gravatar

I have followed the readme.md for the database instructions, but everytime i run the frontend + the server and try to log in, I get the following in the my console:

xhr.js?b50d:187 POST http://localhost:8080/user/signin/local net::ERRCONNECTIONREFUSED

auth.js?889e:41 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'data') at eval (auth.js?889e:41)

I have tried changing the BaseURI etc. Any help would be greatly appreciated.

Gravatar
lukednolanMiles

When I change the route, it gives me 404 not found. This leads me to believe it is finding my API route, but unable to connect for whatever reason. I have seen that cors is implemented also, so it doesnt seem to be a header issue.

User profile image

Hi Luke,

Thanks for the message, we are investigating the issue!

Best regards, Eugene

Gravatar
lukednolanMiles

Thanks!

User profile image

Hi Luke,

Can you take a screenshot of the backend console? Or send me the error logs?

Gravatar
lukednolanMiles

Sure.

I tested it today on firefox and im now getting a more detailed error:

The Same Origin Policy disallows reading the remote resource at http://localhost:8080/user/signin/local. (Reason: CORS request did not succeed)

I see that the template uses cors.

Im running on a Mac by the way. I use brew services start postgres to init my db, and it contains the correct permissions etc. Let me know what else I can provide!

Gravatar
lukednolanMiles

And then on Chrome i get this:

xhr.js?b50d:187 POST http://localhost:8080/user/signin/local net::ERRCONNECTIONREFUSED

auth.js?889e:41 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'data') at eval (auth.js?889e:41)

It fails basically at this point in the frontend:

axios.post("/user/signin/local", creds).then(res => { const token = res.data.token; dispatch('receiveToken', token);

Gravatar
lukednolanMiles

Is there any way I can get the server to give me some error handling i.e. make sure its working, listening on 8080? The frotend is located on 3000, but it requests the backend on 8080.

Gravatar
lukednolanMiles

Also, just as a follow up, what should my project structure be? At the moment I have

Parent folder --> backend folder + frontend folder

I go into frontend to run frontend, and go into a separate terminal and run backend.

Gravatar
lukednolanMiles

Is there a full list of execution instructions? I followed them all, but I realized I get the above error whether the backend is running or not...

User profile image

Contacted you by email

Cookie Consent

By continuing to browse or by clicking 'OK', you agree to the storing of cookies on your device to enhance your site experience and for analytical purposes. To learn more about how we use cookies, please see our cookies policy.