You can view details about this application here. This document only discusses the backend implementation for the application.
I decided to make the backend as a REST API, implemented using Node.js and Express. The database that I used in the first version was MySQL but I switched to MongoDB in this version due to its flexibility - which was suitable for this case. For the ticket propagation, I decided to use Twilio SMS API.
The backend app has been split into various logically related parts, to practice separation of concerns. The express application uses middleware
for related endpoints. The app contains the following parts/modules:
auth
: contains anAuthController
which acts as middleware for authentication related endpoints. There is also aTokenCheck
module available which is for validating tokens sent by the client (authorization)db
: contains a module which deals with database connectionerror
: contains a module which acts as a generic error handler. It is used as error handling middleware in the whole applicationqrcode
: contains theQrCodeController
which groups together endpoints for generating qrcode for ticket verificationticket
: contains a module which groups together the endpoint for generating a valet ticket, as well as the functionality for sending out text messagesuser
: contains aUser
file which defines the structure for a user object (to be stored in the db), i.e it defines a schema for usage with mongooge. There is also aUserController
which acts as middleware for all endpoints related to the user actionsvalet
: contains aValet
file which defines the structure for a valet object (to be stored in the db), i.e it defines a schema for usage with mongooge. There is also aValetController
which acts as middleware for all endpoints related to the valet
Endpoints exposed in the REST API were tested using Postman Client.
The backend is deployed on Heroku cloud.