Add-ons: getting started
This tutorial covers how to get the Node.js “Hello Domains” app running on your machine.
Make sure you followed the previous steps, which are common to all languages and technologies.
A note on frameworks: As the Node.js community has a broad varierty of frameworks, we decided to have the hello-domains app and the corresponding getting started guide in plain Node. If you plan on writing your DNSimple add-on in Node, you might want to consider a framework like hapi, Koa, Sails.js, or Express.js.
To follow this tutorial you will need a current Node.js version on your system. Instructions on installing Node.js may be found on https://nodejs.org/.
The first step is to clone the hello-domains-node repository from github.
> git clone firstname.lastname@example.org:dnsimple/hello-domains-node.git Cloning into 'hello-domains-node'... remote: Counting objects: 27, done. remote: Total 27 (delta 0), reused 0 (delta 0), pack-reused 27 Receiving objects: 100% (27/27), 5.67 KiB | 0 bytes/s, done. Resolving deltas: 100% (12/12), done.
You should now have the application source code on your machine. Feel free to take some time and browse through it.
The hello-domains node application has a few dependencies, including the DNSimple Node.js client, that you need to install:
> npm install email@example.com ~/projects/hello-domains-node ├─┬ firstname.lastname@example.org [...] ├─┬ email@example.com [...] ├── firstname.lastname@example.org └─┬ email@example.com [...]
Now that you have the code and its dependencies on your machine you need to configure the app. To do so, copy the example configuration to
> cp config.example.js config.js
config.clientSecret according to the values you received from DNSimple when you followed the common steps for all languages.
config.session.secret to a randomly generated string. You can generate a random string like so:
> openssl rand -hex 32
Copy and then paste it into
# config.js config.session.secret = 'somelongrandomstring';
> node server.js
Congratulations 🎉, now you should have a working Node.js hello domains add-on running on your machine locally at http://localhost:3000/.
If you encounter any problems please see the Troubleshooting guide.