Skip to content

Latest commit

 

History

History
188 lines (142 loc) · 3.24 KB

README.md

File metadata and controls

188 lines (142 loc) · 3.24 KB

Appointment scheduler REST API microservice

School project

This school project is an appointment scheduler microservice with REST endpoints, developed using Node.js, Express.

About the project

Clients can book 30 minute long appointments. The service will check for colliding appointments and alert the client. Successful bookings will be stored in MongoDB.

Features of version 1.0.0

  • basic CRUD operations
  • the client must include only the very minimal amount of data
    • start time, and/or booked appointment ID (from MongoDB)
    • commenting is optional
  • fitting error messages
    • plus error handler middleware
  • smoke test

Setup requirements

  • Terminal
  • Visual Studio Code
  • Insomnia, Postman
  • Node.js
  • Mongo DB

How to start

  1. Clone the repository and open with Visual Studio Code

  2. Using the terminal:

cd backend
npm install
cd ..
  1. Create an .env file at the backend root
  • fill out with your own data or ask permission from the developer
PORT={your choice, ie: 8080}
APP_URL={your front-end url, ie: http://localhost:3000}
CONNECTION_STRING={your Mongo database}
  1. Start the localhost
cd backend
npm run dev
(<!-- using nodemon in development -->)

Endpoints

GET to api/appointments/?page=

Each page lists 10 appointments.

JSON body:
{
	"date":	"2022-07-19"
}

response:

Will be an array of appointment objects.

[
	{
		"_id": "12345",
		"date": "2022-07-19",
		"startTime": "2022-07-19T06:00:00.000Z",
		"endTime": "2022-07-19T06:30:00.000Z",
		"comment": "quick beard trim",
		"__v": 0
	},
  ...
]

GET to api/appointments/:appointmentID

response.data:

Will return that one appointment

{
  "date": "2022-07-19",
  "startTime": "2022-07-19T06:00:00.000Z",
  "endTime": "2022-07-19T06:30:00.000Z",
  "comment": "quick beard trim",
  "_id": "12345",
  "__v": 0
}

POST to api/appointments

JSON body:
{
	"start": "2022-07-19T08:00",
	"comment": "quick beard trim"
}

response.data:

Will return the created appointment

{
  "date": "2022-07-19",
  "startTime": "2022-07-19T06:00:00.000Z",
  "endTime": "2022-07-19T06:30:00.000Z",
  "comment": "quick beard trim",
  "_id": "12345",
  "__v": 0
}

PATCH to api/appointments/:appointmentID

JSON body:
{
	"start": "2022-07-19T09:00",
	"comment": "beard and hair cut, too"
}

response.data:

Will return the modified appointment

{
  "date": "2022-07-19",
  "startTime": "2022-07-19T07:00:00.000Z",
  "endTime": "2022-07-19T07:30:00.000Z",
  "comment": "beard and hair cut, too"
  "_id": "12345",
  "__v": 0
}

DELETE to api/appointments/:appointmentID

response.data:

Will return the deleted appointment

{
  "date": "2022-07-19",
  "startTime": "2022-07-19T06:00:00.000Z",
  "endTime": "2022-07-19T06:30:00.000Z",
  "comment": "quick beard trim",
  "_id": "12345",
  "__v": 0
}

Main technologies and services

Back-end

Node.js, Express
MongoDB, Mongoose
Jest
Morgan