shazain07/mern-day6 ? reverse-engineered prompt

Reverse engineered prompt

Build me a simple backend API for user authentication.

I want users to be able to register with an email and password, log in, and then get a JWT back if their details are correct. Passwords should be stored securely with hashing, not in plain text. After logging in, I want a protected profile route that only works when I send a valid Bearer token, and it should return the logged in user’s basic info.

Use Node, Express, MongoDB, and Mongoose, and keep the setup clean with separate routes, controllers, models, and middleware. Please add environment variable support for things like the database connection, JWT secret, port, and token expiry. Make sure the app runs locally with a dev command and include a few helpful examples or test requests so I can try the endpoints quickly.

If anything is unclear, use the README style of a basic auth API and keep it simple and practical.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab