This example returns definitions and other metadata for a given word, using Merriam-Webster's Collegiate Dictionary API: https://dictionaryapi.com/. This example also demonstrates authentication using an API key. You can register an API key for free for non-commercial use with Merriam-Webster.
Run packs auth examples/dictionary/pack.ts and enter your API key.
Then run packs execute examples/dictionary/pack.ts Define coda to look
up definitions for a word, in this case coda.
Run the unittests just for this Plugin by using:
mocha --require ts-node/register examples/dictionary/test/dictionary_test.tsThe unittests use a mock http fetcher and do not connect to a real API.
There is also an integration test, which makes real http requests to the API.
To run successfully, this test requires that you've set up an API key already
using packs auth examples/dictionary/pack.ts.
mocha --require ts-node/register examples/dictionary/test/dictionary_integration.ts