Skip to content

An appointment booking server app written using JavaScript and powered by Node JS and the Google Calendar API.

License

Notifications You must be signed in to change notification settings

arytek/NodeJS-Booking-App

Repository files navigation

NodeJS Booking App

An appointment booking server application made using Node JS. This application makes use of the Google Calendar API to create appointment timeslots on Google Calender. The appointment timeslots are 40 minutes in length, and a 5 minute break between each timeslot exists. The timeslots are defined from Monday to Friday, 9AM to 6PM. This application meets all of the requirements listed below. The requirements defined in this booking server are easily customizable. For example, if you would like to define your own timeslots, simply edit the timeslots within timeslots.json.

For a video tutorial on how to setup this application, see this video: https://youtu.be/dWip8MLvEWw
For a video demonstration of this application, see this video: https://youtu.be/IS-V0Xmv1mw

Requirements:

  • All appointments are 40 minutes long and have fixed times, starting from 9–9:40 am. ✔️
  • Ensure there is always a 5 minute break in between each appointment. ✔️
  • Appointments can only be booked during weekdays from 9 am to 6 pm. ✔️
  • Bookings can only be made at least 24 hours in advance. ✔️
  • Appointments cannot be booked in the past. ✔️

Application contents:

ReqHandlers Directory

  • GET-Handlers - A folder containing the GET handlers used in the app.
  • POST-Handlers - A folder containing the POST handlers used in the app.

Utility Directory

  • appUtil.js - Provides functionality used throughout the code base, such as date calculation functions.
  • gcal.js - Utilises the credentials.json file to generate a token.json file. If a token.json file already exists, then an oAuth2 Client is generated and returned.
  • requirements-validator.js - Used to validate requests sent to the server.
  • credentials.json - Your credentials.json file used to authenticate the Google Calendar API used by this app.
  • token.json - The token file generated by gcal.js after authenticating your credentials.json file.

App Working Directory

  • Node-Modules - Generated when running 'npm-install'. A folder containing the npm modules used throughout the app.
  • server.js - The main server file that utilizes express to start a web server.
  • package.json - Package.json file used with npm.
  • package-lock.json - Package-lock.json file used with npm.

Installation and Usage

Instructions:

  1. Clone this repository.
  2. Visit https://developers.google.com/calendar/quickstart/nodejs to activate Google Calander on your Google Account and to generate a credentials.json file if you haven't already done so. Place your credentials.json file into the 'Utility' directory of this application.
  3. In the newly cloned repository, open your command line and run the 'npm install' command to download the required modules.
  4. Run the 'node .' command to run the server.
  5. The booking app is now ready. Try out the following REST requests below.

HTTP REST Routes:

GET  /days?year=yyyy&month=mm

GET  /timeslots?year=yyyy&month=mm&day=dd

POST /book?year=yyyy&month=MM&day=dd&hour=hh&minute=mm

License

NodeJS-Booking-App is copyright (c) 2019, Aryan Nateghnia 38933061+aryannateq@users.noreply.github.com.

NodeJS-Booking-App is free software, licensed under the GPL, Version 3.0. See the LICENSE file for more details.

About

An appointment booking server app written using JavaScript and powered by Node JS and the Google Calendar API.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published