Skip to content

humbertoarndt/ft_transcendence

This branch is up to date with shelsonx/ft_transcendence:main.

Repository files navigation

User Management API

This is a simple user management API that allows you to create, read, update and delete users as well as their friends list and blocked list.

Installation

  1. Go to the root directory of the backend services
cd backend
  1. Run docker-compose to start the services
docker-compose -f docker-compose-user-management.yml up
  1. The API will be available at http://localhost:8080
  2. The PostgreSQL database will be available at http://localhost:5432

Usage

The API has the following endpoints:

Create User

http://localhost:8006/user/

with POST request and the following JSON body:

{
    "name": "John Doe",
    "nickname": "johndoe",
    "email": "[email protected]",
    "avatar": "https://www.example.com/avatar.jpg"
}

Get User

http://localhost:8006/user/{id}

with GET request

Get All Users

http://localhost:8006/user/

with GET request

Update User

http://localhost:8006/user/{id}

with PATCH request and the following JSON body:

{
    "[field]": "[value]"
}

Delete User

http://localhost:8006/user/{id}

with DELETE request

Add Friend

http://localhost:8006/user/{id}/friends/{friendId}

with POST request

Remove Friend

http://localhost:8006/user/{id}/friends/{friendId}

with DELETE request

Get Friends

http://localhost:8006/user/{id}/friends

with GET request

Block User

http://localhost:8006/user/{id}/block/{blockId}

with POST request

Unblock User

http://localhost:8006/user/{id}/block/{blockId}

with DELETE request

Get Blocked Users

http://localhost:8006/user/{id}/block

Run Tests

To run the tests, go to the root directory of the backend services and run the following command:

docker-compose -f docker-compose-user-management.yml run user_management_api python3 manage.py test user_management_api

Frontend

The frontend for this API can be started by goiung to the root directory of the frontend services and running the following command:

npm install -g http-server
http-server

The frontend will be available at http://localhost:8080 and will allow you to interact with the API.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 61.0%
  • JavaScript 27.5%
  • HTML 8.0%
  • CSS 2.3%
  • Shell 0.5%
  • Dockerfile 0.4%
  • Makefile 0.3%