Starting with the Wordnik API in Node.js

Requirements:

Note: Since one of the most common uses of the Wordnik API is to generate random words, my examples will be aimed toward that goal.

Generating and getting your API Key:

Screen Shot 2015-03-25 at 12.57.59 AM

Visit the developer side of Worknik.

On the right-hand side will be a form.

Screen Shot 2015-03-25 at 12.57.40 AM

Complete the form and then click on the “Sign me up for an API key” button. (Yes, it really is that easy.)

Once the key has been generated, it will at the bottom of your user settings page. Right above the section to delete your account will now be your API key.

Screen Shot 2015-03-25 at 1.03.23 AM

Two ways to use the Wordnik API in Node.js:

Using the Node-REST-Client Module

npm install node-rest-client

Start by installing the Node-REST client module. Using this method, we will be constructing a call using the Client object of the module to pass it the options we want via building a query string.

As an example of how to use this method, fill in your API key in the following code.

Using the Wordnik-bb Module

npm install wordnik-bb

Start by installing the wordnik-bb module. For this method, instead of creating a REST client, we can use the module designed specifically for calling the Wordnik API.

As an example of how to use this method, fill in your API key in the following code.