Introduction
This simple web server will perform unit conversion to SI units from their "widely used" counterparts. It has a single method to convert units and it returns a JSON structure.
- Method: GET
- Path: /units/si
- Query parameter: units - A string containing any number of SI units multiplied or divided, which might contain parenthesis. Examples: "degree", "degree/minute", "(degree/(minutehectare))", "ha°"
It doesn't have much in the way of error checking or handling, so if the URL is miss-formed or the calculation cannot be completed, the error it generates is rather raw and unsightly. There are some simple ways to pretty this up but I didn't feel like that was part of the homework and would just add additional complexity.
Requirements
- A relatively up-to-date version of Ruby (2.3.1)
- A relatively up-to-date version of the Bundler gem (1.16.1)
Installation
- Clone the repository:
git clone git@github.com:rnhurt/citrine.io.git
- Change to the Citrine.io directory:
cd citrine.io
- Install the necessary gems:
bundle install
Execution
- Run the web server:
bundle exec ruby main.rb
- Run your tests against localhost on port 4567