/api.daktary.com

Primary LanguageJavaScriptOtherNOASSERTION

api.daktary.com

website : http://api.daktary.com

Build Status JavaScript Style Guide

Installation

Github - Rate limit policies

For requests using Basic Authentication or OAuth, you can make up to 5,000 requests per hour.
For unauthenticated requests, the rate limit allows you to make up to 60 requests per hour. - Github

Read Github instructions to understand the rate limit policies :
rate-limit-for-oauth-applications

Deploy on Heroku

Install:

https://devcenter.heroku.com/articles/heroku-cli

Start with creating an app

$ heroku login
$ heroku create

Now you can specify your token (cf. Github - Rate limit policies)

$ heroku config:get GITHUB_ID=xxxx
$ heroku config:get GITHUB_SECRET=yyyy
$ touch .env
$ heroku config:get GITHUB_ID -s  >> .env
$ heroku config:get GITHUB_SECRET -s  >> .env

Start daktary-api locally

npm run start

Then http://localhost:5000
It runs with nodemon and foreman whose watch the modification to restart on change.

Play Unit Tests

We use http://mochajs.org and http://chaijs.com for managing our unit-tests.

npm test

Play Functional Tests

In test folder, you can get the autonomous page : api_test_html

You can open it in your favorite browser. It try to play with the local or distant API.

Linter

We use standardjs as linter.

npm run lint

API Usage

Load a Github document

In your console, you can try :

For a file

fetch('http://api.daktary.com/daktary-team/api.daktary.com/blob/master/README.md')
    .then(rep => rep.json())
    .then(json => console.log(json))

For a folder

fetch('http://api.daktary.com/daktary-team/api.daktary.com/tree/master/test')
    .then(rep => rep.json())
    .then(json => console.log(json))

See the home to see all possibilities : http://api.daktary.com

Licence

MIT


Spikes