This is a simple API built using Express.js and MongoDB to manage participants registering their interest for the Laptop4Dev program. It allows viewing all Applicants, registering new ones, and checking the total number of participants.
- Register participants with required details.
- View all Applicants who have shown interest in the program.
- Check the total count of participants.
- Simple error handling for missing fields or failed operations.
- Node.js
- MongoDB (local or cloud database)
Clone the repository to your local machine:
git clone https://github.com/Jhaemis-hack/Laptop4Dev-Api.git
Navigate into the project directory and install the necessary dependencies:
cd Laptop4Dev-Api
npm install
Start the server on port 4000
:
npm start
Your server will be running at http://localhost:4000
.
This app uses MongoDB for storing participant data. Ensure you have MongoDB installed and running locally or use a cloud MongoDB service like MongoDB Atlas.
The database is set to connect to mongodb://localhost:27017/lap4dev
. Change the connection string in the app.js
file if needed for a different database.
Retrieve all participants who have registered their interest for the program.
Response:
{
"message": [
{
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]",
"phoneNo": 1234567890,
"purpose": "Learn development"
},
]
}
Register a new participant by providing the following details in the request body:
firstname
(String) - Requiredlastname
(String) - Requiredemail
(String) - RequiredphoneNo
(Number) - Requiredpurpose
(String) - Required
Request Example:
{
"firstname": "Jane",
"lastname": "Doe",
"email": "[email protected]",
"phoneNo": 9876543210,
"purpose": "Build my first app"
}
Response:
{
"message": "Registration successful",
"data": {
"firstname": "Jane",
"lastname": "Doe",
"email": "[email protected]",
"phoneNo": 9876543210,
"purpose": "Build my first app"
}
}
Retrieve the total number of participants who have registered.
Response:
{
"count": 100
}
- 400 - Bad Request: Missing required fields or invalid data.
- 404 - Not Found: Route not found.
- 500 - Internal Server Error: Server error.
Follow the link below to view postman documentation fot this API: https://documenter.getpostman.com/view/30020558/2sAYHzF2qt#8ce79b57-a3eb-4948-8f30-a67be6ee9f83