Skip to content

baptistefkt/REST-API-Challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node REST API

This is a simple REST API that compute prices and eligibility for a car insurance. This recruiting challenge was submitted by Seraphin.be

Installation

$ git clone [email protected]:baptistefkt/REST-API-Challenge.git
$ cd REST-API-Challenge
$ npm install

Dependencies

Test dependencies

Description

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.

How to use

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"

Examples

  1. 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"}}}
  1. Using Postman :

postman

Testing

$ npm run test

Contributor

Baptiste Firket (BeCode)

About

Build a simple REST-API with Node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published