This document provides information about the APIs and deployment for this project.
The home route where two buttons appear:
- ADD RECORD: Adds a new record to the database.
- SHOW HISTORY: Shows the history of records.
Renders the addRecord
page, allowing users to input an image (less than 2MB, JPG, JPEG, PNG only). After clicking the submit button, a POST /record/add
request is made. The server calls the Google Vision API to extract data, saves it to the database, and redirects to /record/:recordId
.
Creates a new record by calling the Google Vision API to extract data from the submitted image and saves it to the database. Redirects to /record/:recordId
.
Displays information about a specific record, including its status and extracted information. Provides a button to edit the record.
Renders a form to edit the given record, allowing users to change the extracted information, or they can Delete the record which calls record/delete/:recordId
.
Updates the information of the specified record based on the submitted form.
Deletes the record from the database if the recordId exists.
Renders the history page containing all past submitted records. Includes filter options to search through records based on status, creation date, date of birth, date of issue, and date of expiry. Users can choose any combination to filter the history of records.
To deploy and run the application:
-
Create a
.env
file in the root directory with two environmental variables:PORT
: Relevant port numberMONGO_URL
: MongoDB database URL
-
Create an account on Google Cloud Platform.
-
Enable the Google Vision API.
-
Create a service account and get the JSON credential.
-
Rename the credential file as 'credential.json'.
-
In the terminal, run
npm install
to install the required packages. -
To start the project, run
npm start
.