This is a RESTful API implemented using Node.js and Express framework. It provides two endpoints for creating and retrieving medical bills.
GET /bills
: returns a list of medical billsPOST /bills
: creates a new medical bill
A medical bill has the following properties:
- patient name and address
- the hospital name
- date of service
- bill amount.
Both endpoints accept and return JSON.
Follow the instructions below to set up the application on your local machine.
- Clone the repository
- Navigate to the project directory
- Install the dependencies:
npm install
- Start the server:
npm start
- The API should now be available at
http://localhost:3000/
.
The tests can be run by executing the following command: npm test
The inputs are validated before creating a new medical bill. The following validation rules are applied:
- Patient name and address must be a string
- Hospital name must be a string
- Date of service must be a valid date in the format
YYYY-MM-DD
- Bill amount must be a number.