Skip to content

Latest commit

 

History

History
168 lines (132 loc) · 6.04 KB

readme-en.md

File metadata and controls

168 lines (132 loc) · 6.04 KB
🇺🇸 English
🇧🇷 Português

luk4x-repo-status luk4x-repo-license

👥 Users Project API


Video   |    Technologies   |    About   |    Routes   |    Middlewares   |    Cloning   |    Contact


📹 Project Video Presentation

user-register-API.mp4

If the video has any errors, reload the page!
Access the project online HERE

🚀 Technologies Used

📝 About

Watching the video above and/or accessing the project online will help you understand the explanation!

This project is the Users API, a web application that performs the registration and management of users, serving as the basis for its Interface that I developed essentially in ReactJS.

📃 Routes and Examples

  • POST /users: This route is given the user's name and age. this information is passed by the body of the request, and based on it a new user is registered in an array, in the following format:

    {
      name: "Lucas",
      age: 18,
      id: "06d5e912-d672-49ca-92c9-5a4e0e470f15"
    }

    The id information is generated in the system by the uuid library and incorporated into the user.
    This route also has a check to prevent users with incomplete data from being registered.

  • GET /users: This route lists all users registered in the array.

  • GET /users/:id: Based on the id sent, this route returns a specific user.

  • PUT /users/:id: Based on the id sent, this route can change one or all of a user's data (except the id).

  • DELETE /users/:id: Based on the id sent, delete the user who owns it.


  • When calling the POST /users route twice, passing { name: "Hana", age: 23 } through body, the array looks like this:
[
    {
      name: "Hana",
      age: 23,
      id: "05a5913e-h325-da2a-75c9-93f20e02fa19"
    },
    {
      name: "Hana",
      age: 23,
      id: "e671f3a7-4d0a-4c44-b850-c16ab6785e89"
    }
];
  • When calling the GET /users/e671f3a7-4d0a-4c44-b850-c16ab6785e89 route, the return is:
{
  name: "Hana",
  age: 23,
  id: "e671f3a7-4d0a-4c44-b850-c16ab6785e89"
};

🔑 Middlewares

  • checkUserId: Its function is to check if the received ID exists and take action if it doesn't. It is used on all routes that are given an ID.

  • showMethodNUrl: Its function is to show in the console the method (GET,POST,PUT,DELETE, etc) and also the url of the request. It is used in all requests and is only intended to facilitate and organize development.

  • verifyUserData: Its function is to verify the user data sent by the body, and take action if this request intends to modify data that the user does not have permission to.

📖 Cloning the Project

To clone and run this project on your computer you will need Git, Node.js v16.13.2 or higher, Yarn, and preferably an API Client such as Insomnia (but can also be accessed through the browser) previously installed.
In the terminal:

# Clone this repository with:
> git clone https://github.com/Luk4x/user-register-API.git

# Enter the repository with:
> cd user-register-API

# Install dependencies with: 
> yarn install

# Run the project with:
> yarn app

# Once this is done, you will be able to access the project through the link that will appear in the terminal! (something like http://localhost:3001/ or http://127.0.0.1:5173/)

🤝 Contributor Contact

Vitrine.Dev 🪟
Luk4x Github Photo
Lucas Maciel
🪧 Vitrine.Dev Lucas Maciel
✨ Name 👥 Users Project API
🏷️ Technologies nodejs, expressjs, javascript, uuid, yarn
📷 Img vitrine.dev thumb

Back to Top