1.Introduction 2.Prerequisites 3.Getting Started 4.API Endpoints 5.Signup 6.Request and Response Examples 7.Error Handling 8.Technologies Used
This API is designed to provide a signup form for users with password hashing functionality. The passwords are securely hashed before being stored in the database.
Make sure you have the following installed:
1.Node.js 2.npm (Node Package Manager) 3.MongoDB
-
Clone the repository:
git clone https://github.com/BinoB/sign_up_form_backend
2.Install dependencies:
cd signup_up_form_backend npm install
- Configure MongoDB:
Create a .env file in the root directory. Add your MongoDB connection string:
MONGO_URI=your_mongodb_connection_string
4.Start the server:
npm run server
- Server will be running at http://localhost:5000.
Method: POST
Endpoint: /signup
Description: Register a new user with a hashed password.
{ "name": "John Doe", "mobileNumber": "1234567890", "email": "john.doe@example.com", "password": "securepassword", "address": "123 Main Street", "pincode": "54321", "city": "Anytown", "dob": "1990-01-01", "longitude": "12.345678", "latitude": "34.567890", "modeOfDelivery": "Home Delivery" }
HTTP/1.1 201 OK Content-Type: application/json
{ "message": "User registered successfully" }
400 Bad Request: { "error": "Bad Request", "message": "Invalid request body" }
500 Internal Server Error:
{ "error": "Internal Server Error", "message": "An unexpected error occurred" }
Node.js Express.js MongoDB bcrypt (for password hashing) dotenv (for environment variable configuration)