This is a simple REST API that compute prices and eligibility for a car insurance. This recruiting challenge was submitted by Seraphin.be
$ git clone [email protected]:baptistefkt/REST-API-Challenge.git
$ cd REST-API-Challenge
$ npm install
As this API is a micro-service, the all app is in a single file : index.js
The API do not store any data, so there is no database.
Just make a POST request on
http://localhost:8080/v1/quote/car-insurance
with the following body parameters:
Key | Value | Description |
---|---|---|
car_value(required) | number | Float, value of the car excl. VAT |
driver_birthdate(required) | string | Of the form "DD/MM/YYYY" |
- Using
curl
:
In the terminal, this request :
$ curl -H "Content-Type: application/x-www-form-urlencoded" -d "car_value"="10000" -d "driver_birthdate"="21/06/1990" http://localhost:8080/v1/quote/car-insurance
send this response :
{"success":true,"message":"quote successfully computed","data":{"eligible":true,"premiums":{"civil_liability":500,"omnium":"300"}}}
- Using Postman :
$ npm run test