Auto Insruance services consists of two endpoints, one to calculate premium and another one to post the user details.
- Clone the repositories and install the dependencies
$ npm i
- start the server
$ npm start
- Clone the repositories and install the dependencies
AWS_ACCESS_KEY_ID = "XXXXXXX"
AWS_SECRET_ACCESS_KEY = "XXXXX"
AWS_DEFAULT_REGION = "ap-northeast-1"
COGNITO_USER_POOL_ID = "XXXXX"
COGNITO_APP_CLIENT_ID = "XXXXX"
NOTE
NodeJS version - v14.19.3
POST /api/v1/calculate
- type:
'car' | 'bike'
- liscenceType:
'gold' | 'blue' | 'green'
- dob:
Date
- estimateDistance:
Number
- towingService:
boolean
- lawyerService:
boolean
{
premium: `xxx` }
}
{
success: false,
message: <err message>
}
POST /api/v1/user
- type:
'car' | 'bike'
- liscenceType:
'gold' | 'blue' | 'green'
- dob:
Date
- estimateDistance:
Number
- towingService:
boolean
- lawyerService:
boolean
- name:
string
- address:
string
- liscenceNumber:
string
{
"success": true,
"message": "user saved successfully"
}
- Database is running on AWS dynamoDB (NoSQL). The document structure is defined as below.
{
"liscenceId": "123456789123",
"address": "1-5-8",
"age": 25,
"dob": "2020-02-04T10:58:49.024Z",
"estimateDistance": 3000,
"lawyerService": false,
"liscenceNumber": "xxxxxxxxxxxx",
"liscenceType": "gold",
"name": "sharath",
"towingService": true,
"type": "bike"
}
- Dynamodb
- Tests