Skip to content

Translate numbers into English as a service πŸ’‚β€β™‚οΈ

Notifications You must be signed in to change notification settings

omartell/numeralia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Numeralia Circle CI

Translate numbers into English πŸ‡¬πŸ‡§

Usage

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

Structure

  • 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 /numerals is 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.

Developing

Setup

When you first clone this repository, run:

lein setup

This 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 FIXME

Environment

To begin developing, start with a REPL.

lein repl

Run go to initiate and start the system.

user=> (go)
:started

By 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 (...)
:resumed

Testing

Testing is fastest through the REPL, as you avoid environment startup time.

user=> (test)
...

But you can also run tests through Leiningen.

lein test

Deploying

To deploy the project, run:

lein deploy

Legal

Copyright Β© 2016 Oliver Martell

About

Translate numbers into English as a service πŸ’‚β€β™‚οΈ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published