-
Node.js
-
A package manager of your preference
- Yarn
- npm
-
MongoDB Atlas account
- Clone the GitHub repository in the desired folder. You can do it by copying the https link, the ssh link or downloading the zip file:
- cloning with https link:
git clone https://github.com/kellysondias/events-api
- cloning with ssh link:
git@github.com:kellysondias/events-api.git
- After the project has been downloaded, you can navigate to the project's directory and install the dependencies with a package manager of your preference:
- Navigate to the project's directory:
cd path\of\your\cloned\folder
-
Yarn command:
yarn install
-
npm command:
npm install
- Create a
.env
file in the root directory (in the same level aspackage.json
). You can find a more practical example in the .env.example file.
- Set the variables as below replacing the
<>
fields with your information:
-
MONGO_URI
: "This is where your MongoDB Atlas URI will be set to create a database connection" -
PORT
: "This is where you'll choose in which port your local host server will run"- Note: if
PORT
is not defined, it is set to3000
automatically
- Note: if
-
JWT_SECRET
: "This is where you'll store your JWT secret string for creating user's validation"- You can run the
openssl rand -base64 32
command to generate a secret string
- You can run the
Example:
MONGO_URI='<your_db_URI>'
PORT=<choose_a_port>
JWT_SECRET=<your_secret>
After all this configuration is set and ready to go:
- Run the app with the dev script.
-
Yarn command:
yarn dev
-
npm command:
npm run dev
And now the API should be officially running :] .
Note: <URL>
equals localhost:<your_port>/api/v1
- HTTP Method
- POST (Signs-up a new user)
- Required fields:
{ "firstName": "Lorem", "lastName": "Doe", "birthDate": "2023-12-28", "city": "string", "country": "string", "email": "[email protected]", "password": "Password1", "confirmPassword": "Password1" }
- Required fields:
- POST (Signs-up a new user)
- HTTP Methods
- POST (Signs-in an user generating a web token)
- Required fields:
{ "email": "[email protected]", "password": "Password1", }
- Required fields:
- POST (Signs-in an user generating a web token)
Note: Every event route is only accessible through user's sign-in authentication
-
HTTP Methods
-
POST (Creates a new event)
- Required fields:
{ "description": "string", "dayOfWeek": "monday" }
- Required fields:
-
GET (Gets all events or specific events based on the day of the week they were created)
- Request parameter (optional):
dayOfWeek=<day_of_week>
- Request parameter (optional):
-
DELETE (Delete specific events based on the day of the week they were created)
- Request parameter (required):
dayOfWeek=<day_of_week>
- Request parameter (required):
-
-
HTTP Methods
-
GET (Gets all events based on the user's id)
-
DELETE (Deletes all events based on the user's id)
-