- Ruby
- Node.js (>= v6.10)
- Redis
- yarn
For the sake of brevity, I'm going to assume the user has at least the first three binaries above already present on their machine or knows how to get them. "yarn" can be installed via brew. brew install yarn
It's a package manager that is quickly overtaking "npm".
cd
intoanagram-api
.- Type
yarn install
to install all dependencies. - Ensure Redis is running by executing
redis-server
- Run
yarn run api
to start the Express.js server - In a new terminal window run
yarn run tests
to execute the Ruby tests. - ?
- Profit
In all seriousness, I'm sure the team sees a fair share of these projects with build issues. I'm happy to help troubleshoot if there are problems getting it up and going.
I completed all of the required routes as well as three of the optional items below (with test coverage).
- Respect a query param for whether or not to include proper nouns in the list of anagrams
- Endpoint that takes a set of words and returns whether or not they are all anagrams of each other
- Endpoint to delete a word and all of its anagrams
-
POST /words.json
: Takes a JSON array of English-language words and adds them to the corpus (data store). -
POST /word_list.json
: Takes a JSON array of words and returns whether they are all anagrams of each other. -
GET /anagrams/:word.json
: Returns a JSON array of English-language words that are anagrams of the word passed in the URL. Supports two optional query params: (limit, exclude_proper_nouns). -
DELETE /anagrams/:word.json
: Deletes a word and all of its anagrams from the store. -
DELETE /words/:word.json
: Deletes a single word from the data store. -
DELETE /words.json
: Deletes all contents of the data store.