Code-with-pratyush / User-Authentication

0 stars 1 forks source link

Error 404 on API Request: POST http://localhost:3000/api/register #1

Open Code-with-pratyush opened 4 months ago

Code-with-pratyush commented 4 months ago

I'm encountering a 404 error when attempting to register a user via the POST API request to http://localhost:3000/api/register. This issue occurs during the registration process in my React application.

Steps to Reproduce

  1. Clone the repository and navigate to the project directory.
  2. Start the local development server (usually with npm start or yarn start).
  3. Go to the registration page.
  4. Fill in the required registration details.
  5. Submit the registration form.

Expected Behavior

The API request should successfully register the user and return a 200 status code with the appropriate response.

Actual Behavior

The API request returns a 404 Not Found error. Below is the relevant error log from the browser console:

You can find the issue diagrammatic view by navigating through below link: Error in UI: register Error in console: issue 1 issue2

Could you please help identify the cause of the 404 error and provide guidance on resolving it? Thank you for your assistance!!

geekananya commented 3 months ago

Hi @Code-with-pratyush, I ran the project and caught some points worth noting:

You should check for this in your own .env file, and remove the "comment" as well. I changed this and the /register endpoint seemed to work fine. If the issue still persists though, let me know; also make sure you are running the code in the main branch, which i cloned.

Hope this resolves your issue :)