Skip to content

Node.js app using RESTful API to manage user data, including creating, reading, updating, and deleting user information. The application containerised using Docker and utilize PostgreSQL as the database backend.

Notifications You must be signed in to change notification settings

os-ct/user-express

Repository files navigation

User Management API

This project is a RESTful API for managing user data, including creating, reading, updating, and deleting user information. The application is containerized using Docker and utilizes PostgreSQL as the database backend.

Setup and Installation

  1. Clone the repository:
git clone https://github.com/os-ct/user-express.git
  1. Change to the project directory:
cd user-express
  1. Build the Docker images:
docker-compose build

Running the Application

To run the application with Docker and docker-compose, follow these steps:

  1. Start the services:
docker-compose up -d

This command will start the application and database services.

  1. Access the API endpoints:

The API will be available at http://localhost:3000. Use a tool like Postman or curl to interact with the API endpoints.

Postman collection to import: user-express.postman_collection.json

API Endpoints

The following API endpoints are available:

Create User

  • Endpoint: POST /api/users
  • Request Body:
    {
      "first_name": "string",
      "last_name": "string",
      "phone": "string"
    }
  • Response:
    • Status Code: 201 Created
    • Body: The newly created user object

Read User

  • Endpoint: GET /api/users/:id
  • Path Parameters:
    • id: The user's ID
  • Response:
    • Status Code: 200 OK
    • Body: The user object with the specified ID

Read User List

  • Endpoint: GET /api/users
  • Response:
    • Status Code: 200 OK
    • Body: The users object list with the specified IDs

Update User

  • Endpoint: PUT /api/users/:id

  • Request Body:

    {
      "first_name": "string",
      "last_name": "string",
      "phone": "string"
    }
  • Response:

    • Status Code: 200 OK
    • Body: The newly updated user object

    Delete User

  • Endpoint: DELETE /api/users/:id

  • Path Parameters:

    • id: The user's ID
  • Response:

    • Status Code: 200 OK
    • Body: User deleted successfully message
  1. Stop the services:
docker-compose down

This command will stop and remove containers, networks

About

Node.js app using RESTful API to manage user data, including creating, reading, updating, and deleting user information. The application containerised using Docker and utilize PostgreSQL as the database backend.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published