Skip to content

Latest commit

 

History

History
73 lines (52 loc) · 1.83 KB

File metadata and controls

73 lines (52 loc) · 1.83 KB

User Management App Example

Example project demonstrating the use of Node.js, Express, PostgreSQL, React, and Docker.

Note: This project is not intended to be used in production. It is only meant to be used as a learning tool. I know the passwords aren't hashed, and are displayed as plain text, if you want this feature, feel free to add it yourself.

Get Started

Prerequisites

  • Docker (Required)
  • Docker Compose (Required)
    • Note: Docker Compose is included with Docker Desktop for Windows and macOS
  • Node.js (Optional)

Installation

Once you pull the project down and are inside the root directory, run the following command:

docker-compose up --build

Cleanup

After you are done with the project, run the following command to remove the containers:

docker-compose down

If you want to remove the volumes (helpful for debugging), add the -v flag:

docker-compose down -v

Environments

  • localhost:1337: Node.js server
  • localhost:3000: Vite development server

Endpoints

Below are the endpoints that are available for the Node.js server.

Method Route Description
GET / Returns a build version of the React app
GET /api Returns a welcome message
GET /api/users Returns all users
GET /api/users/:id Returns a single user
POST /api/users Creates a new user
PUT /api/users/:id Updates a user
DELETE /api/users/:id Deletes a user

Example request body for POST and PUT requests:

// POST /api/users
{
  "name": "User Name",
  "email": "user@xample.com",
  "password": "password"
}
// PUT /api/users/1
{
  "name": "New Name",
}