/domain-tracker-api

Primary LanguageJavaScriptMIT LicenseMIT

About

I use this api to track my domains across various registrars.

It is licensed under MIT, so feel free to use it for any project and of course please feel free to raise issues and contribute through pull requests.

Demo (hosted on heroku free plan - available 18h/day)

Features

Installation

Clone this repository to your development machine:

git clone https://github.com/iRomain/domain-tracker-api.git

Enter the newly created directory:

cd domain-tracker-api

Install NPM dependencies:

npm install

Dev

js-standard-style

Run npm run dev-start, it will automatically test, lint and start your API, watching any modification and re-linting/starting with nodemon.

NPM sets the environment variable NODE_ENV=dev

Use TDD:

  1. Write a test in ./test/
  2. Add your endpoint in ./lib/api.js
  3. Run npm run dev-start

You can see your API on http://localhost:3000 and see its documentation on http://localhost:3000/documentation

Test

Travis CI Build Status

This API is compatible with Travis.

It sets the environment variable NODE_ENV=test

Add this repo (which you most likely forked already):

  1. Sync Travis with your Github account and add this repo
  2. Push your repo (if you didn't change/remove the deploy part, it will fail at deployment)

Code Climate Code Climate Test Coverage

This API is compatible with Code Climate through the Travis/Code Climate integration

  1. Add this repo to Code Climate and get the repo token
  2. Edit the addons.code_climate.repo_token in .travis.yml Tip: Use Travis to encrypt your token with travis encrypt <token> --add addons.code_climate.repo_token

This API is also compatible with Codacy Codacy Badge

Prod

Heroku hosting Deployment Status

This API is compatible with Heroku through the Travis/Heroku integration.

Create a new app on Heroku:

Change the Deploy configuration in .travis.yml:

  1. Change your deploy.app name
  2. Change your deploy.api_key Tip: Use Travis to encrypt your api key with travis encrypt <api key> --add deploy.api_key

Push to GitHub:

  1. Watch the build in Travis
  2. Watch the deployment in Heroku
  3. Your API is now available on https://<app name>.herokuapp.com/documentation

Docker image

A Docker image is automatically built by using the Travis/Docker integration. It could be setup with docker hub automated build functionality but I prefer how everything can be configured in .travis.yml close to the code.

Change the Docker image build configuration in .travis.yml:

  1. Change your image repo in before_install for both the build and push commands
  2. Change your encrypted docker password with travis encrypt DOCKER_PASSWORD="<docker password>" --add

New Relic monitoring

This API is compatible with New Relic through the Heroku/New Relic integration

  1. Add the New Relic element to your app
  2. Edit the app_name in newrelic.js with your heroku app name (recommended but could be any name)
  3. Edit the logging.level in newrelic.js to suit your desired logging level

Original credits to: iRomain/api-bootstrap