Skip to content

Latest commit

 

History

History
76 lines (60 loc) · 2.17 KB

README.md

File metadata and controls

76 lines (60 loc) · 2.17 KB

Credit Transaction Service

Objective

Implement a service application which takes customer credit transactions as input and calculates minimum, maximum and ending balance by month for every customer.

Tech Stack

  • Nodejs
  • Expressjs
  • Google Firebase Storage

Pre-requisites

Getting Started

  • Clone the repository
git clone  <project_url>

  • Install dependencies
cd <project_name>
npm install
  • Create a project in google firebase console and add the serviceAccountKey.json in the root directory.
// serviceAccountKey.json
{
	"type":  "",
	"project_id":  "",
	"private_key_id":  "",
	"private_key":  "",
	"client_email":  "",
	"client_id":  "",
	"auth_uri":  "",
	"token_uri":  "",
	"auth_provider_x509_cert_url":  "",
	"client_x509_cert_url":  ""	
}
  • Add .env file in the root directory
PORT=8000
GCS_STORAGE_URL='<gc_project_url>.appspot.com'
  • Build and run the project
npm run start
  • Navigate to http://localhost:8000.

API endpoints

GET: localhost:8000/api/ping/test

POST: localhost:8000/api/local/upload/csv

  • The post endpoint will upload the input csv to root directory

project_name/uploads/1672213221072-inputFile.csv

  • The output csv file will be created in the root directory

project_name/outputs/1672213221072.csv

POST: localhost:8000/api/cloud/upload/csv

  • The post endpoint will upload the input csv to root directory

project_name/uploads/1672213221072-inputFile.csv

  • The output csv file will be created in the root directory. This endpoint will also upload the generated file to firebase and returning a download url for the same.

project_name/outputs/1672213221072.csv

Complete details related to application endpoints, request body and sample response can be found in this Postman Collection.

References

Refer here to setup a new google firebase project and generate serviceAccountKey.json .