The Waitlist API is designed to manage a simple waitlist. It provides endpoints to add an email to the waitlist and retrieve all emails in the waitlist. Access to the getWaitlist endpoint is restricted and requires a auth token for authentication.
- Clone the repository to your local machine.
- Run
npm install
to install all dependencies. - Set up your MongoDB database.
- Create a
.env
file in the root of your project and add your mongodb url and auth token like so:AUTH=YourSecretBearerToken MONGODB_URL=url
. - Start the server with
npm start
.
Add an email address to the waitlist.
{
"email": "[email protected]"
}
200 OK
on success:
{
"message": "Email added to the waitlist."
}
400 Bad Request
if the email is invalid or missing:
{
"message": "Email address is required."
}
500 Internal Server Error
if there's a server error:
{
"message": "Error message"
}
Retrieve all emails in the waitlist. This endpoint requires a bearer token for authentication.
Authorization: Bearer YourSecretBearerToken
200 OK
on success:
[
"[email protected]",
"[email protected]",
"[email protected]"
]
401 Unauthorized
if the bearer token is missing.403 Forbidden
if the bearer token is invalid.500 Internal Server Error
if there's a server error.
All other undefined routes will return a 404 H3llo MudaFvcka
error.
This API uses bearer token authentication to protect the /getwaitlist
endpoint. Ensure that the bearer token is kept secret and is only shared with authorized clients.