/appointment-app

A sample React, Node.js and Express App.

Primary LanguageTypeScript

APPOINTMENTS CRUD EXPRESS APP - Table of Contents

Getting Started with Create React App

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

yarn install

Downloads and installs all project dependencies.

yarn start-server

Runs the backend. Default port is 8181, viz: http://localhost:8181

yarn start

Runs the frontend in the development mode.
Open http://localhost:3000 to view it in the browser.

yarn eject

Note: this is a one-way operation. Once you eject, you can’t go back!

If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

API

HTTP

The following endpoints are available. You can download the Postman Collection and Postman Environment to test

Postman Collection: doc/postman_collection.json

Create Appointment

Creates a new Appointment.

Request

POST /appointments

JSON BODY

Key Required Description
date true The date of the appointment
time true The time of the appointment
description true The description of the appointment

Example POST https://localhost:8181/appointments

{
    "date": "08-08-1234",
    "time": "11:45",
    "description": "Orthodontist - Check Up"
}

Response

[201 - Created]

JSON Body

{
    "data": {
        "id": "9f0d63d8-b2a5-40c9-adc3-c2a5f6ae076e",
        "createdAt": "2021-07-19T21:32:54.433Z",
        "updatedAt": "2021-07-19T21:32:54.433Z",
        "date": "08-08-1234",
        "description": "Orthodontist - Check Up",
        "time": "11:45"
    }
}

Update Appointment

Updates the given Appointment

Request

PUT /appointments/{appointmentId}

JSON BODY

Key Required Description
date false The date of the appointment
time false The time of the appointment
description false The description of the appointment

Example [POST] https://localhost:8181/appointments/{87cfe128-5dbf-4ca5-9671-bbe720a800f0}

{
    "date": "12-09-2021",
    "time": "12:30"
}

Response

Example:

[200 - OK]
{
    "data": {
        "id": "87cfe128-5dbf-4ca5-9671-bbe720a800f0",
        "updatedAt": "2021-07-20T18:49:38.714Z",
        "date": "12-09-2021",
        "time": "12:30"
    }
}

Get Appointments

Get a list of all appointments

Request

GET /appointments

Query Params

Query Param Description
offset The page number to start getting the appointments from (0 index based)
limit The maximum number of results to get per page

Response

Example:

GET https://localhost:8181/appointments?limit=10&offset=1

Response

[200 - OK]
{
    "offset": 1,
    "limit": 10,
    "data": [
        {
            "id": "87cfe128-5dbf-4ca5-9671-bbe720a800f0",
            "description": "Orthodontist - Check Up",
            "time": "11:45",
            "date": "08-08-1234",
            "updatedAt": "2021-07-19T21:28:48.046Z",
            "createdAt": "2021-07-19T21:28:48.046Z"
        },
        {
            "id": "9f0d63d8-b2a5-40c9-adc3-c2a5f6ae076e",
            "description": "Interview - Sebenza WIFI",
            "time": "11:45",
            "date": "08-08-1234",
            "updatedAt": "2021-07-19T21:32:54.433Z",
            "createdAt": "2021-07-19T21:32:54.433Z"
        }
    ]
}

Get Appointment By Id

Get a specific appointment identity by an id.

Request

GET /appointments/{appointmentId}

Path Params

Path Param Description
appointmentId The appointment id

Response

Example:

GET https://localhost:8181/appointments/87cfe128-5dbf-4ca5-9671-bbe720a800f0

Response

[200 - OK]
{
    "data": {
        "id": "87cfe128-5dbf-4ca5-9671-bbe720a800f0",
        "description": "Orthodontist - Check Up",
        "time": "11:45",
        "date": "08-08-1234",
        "updatedAt": "2021-07-19T21:32:54.433Z",
        "createdAt": "2021-07-19T21:32:54.433Z"
    }
}

Delete Appointment By Id

Delete a specific appointment identity by an id.

Request

DELETE /appointments/{appointmentId}

Path Params

Path Param Description
appointmentId The appointment id

Response

Example:

DELETE https://localhost:8181/appointments/87cfe128-5dbf-4ca5-9671-bbe720a800f0

Response

[200 - OK]

TODO

  • Use a very much scalable, concurrent Database System such as MySQL, DynamoDB or MongoDB.
  • Add authentication and add a relationship between Users and Appointments
  • Split the frontend and backend into 2 separate repositories
  • Allow Appointments to be marked as Done, etc.. So would need to add more fields to the Appointments structure.