Translate numbers into English π¬π§
Send a GET request to /numerals/{n} with a number smaller than one trillion. You can click on the following links to see a few examples: 172, 1,789, 9,873,456.
Alternatively, use a tool like CURL to change the Accept header and get different representations:
JSON
curl -i -H "Accept: application/json" http://numeralia.herokuapp.com/numerals/279
EDN
curl -i -H "Accept: application/edn" http://numeralia.herokuapp.com/numerals/72341
YAML
curl -i -H "Accept: application/x-yaml" http://numeralia.herokuapp.com/numerals/384347
- The core of the translation logic is defined in numeralia.core and the main function that does the actual conversion is
number->english. - The endpoint
/numeralsis defined in numeralia.endpoint.numerals to accept HTTP GET requests to translate numbers. - The project uses duct as a template for the project to facilitate setup and deployment to heroku.
- The request accept header and response content type is handled by a ring middleware provided by ring.middleware.format.
- The application gets bootstrapped using component by defining a handler, endpoint and server component in system.clj. The entry point is in main.clj.
When you first clone this repository, run:
lein setupThis will create files for local configuration, and prep your system for the project.
Next connect the repository to the Heroku app:
heroku git:remote -a FIXMETo begin developing, start with a REPL.
lein replRun go to initiate and start the system.
user=> (go)
:startedBy default this creates a web server at http://localhost:3000.
When you make changes to your source files, use reset to reload any
modified files and reset the server.
user=> (reset)
:reloading (...)
:resumedTesting is fastest through the REPL, as you avoid environment startup time.
user=> (test)
...But you can also run tests through Leiningen.
lein testTo deploy the project, run:
lein deployCopyright Β© 2016 Oliver Martell