Microservices that fetches GitHub data from certain npm & bower packages.
Built with Node, Hapi, and Redis. Hosted on Heroku. Monitored on New Relic.
How it works?
API endpoints
Note: This API is not versioned and may be changed at any moment. Use at your own risk.
PUT /repos
- Fetches
/packages. - Requests GitHub API for each repo.
- Filters unnecessary keys from each JSON entry.
- Saves result data into Redis.
curl -X PUT fetch.customelements.io/repos
GET /repos
- Gets data from Redis based on the operation above.
curl -X GET fetch.customelements.io/repos
{ "22607013": { id: 2274210, name: "dtreemap", owner: "ibm-js", description: "TreeMap Custom Element", created_at: "2011-08-26T13:32:32Z", pushed_at: "2015-05-05T11:36:27Z", stargazers_count: 9, forks_count: 8 }, {...} }
PUT /packages
- Fetches
/packages/bower. - Fetches
/packages/npm. - Aggregates packages that contains the same GitHub repo.
- Merges the two arrays.
- Saves result data into Redis.
curl -X PUT fetch.customelements.io/packages
GET /packages
- Gets data from Redis based on the operation above.
curl -X GET fetch.customelements.io/packages
{ "kentaromiura/custom-element": { "bower": { "name": "custom-element", "keywords": ["web-components"] }, "npm": { "name": "declarative-custom-element", "keywords": ["web-components"] } }, {...} }
PUT /packages/bower
- Fetches all packages from Bower that contains the
web-componentskeywords. - Filters unnecessary keys from each JSON entry.
- Saves result data into Redis.
curl -X PUT fetch.customelements.io/packages/bower
GET /packages/bower
- Gets data from Redis based on the operation above.
curl -X GET fetch.customelements.io/packages/bower
{ "zenorocha/voice-elements": { "bower": { "name": "voice-elements", "keywords": ["web-components"] } }, {...} }
PUT /packages/npm
- Fetches all packages from npm that contains the
web-componentskeywords. - Fetches each package metadata.
- Filters unnecessary keys from each JSON entry.
- Saves result data into Redis.
curl -X PUT fetch.customelements.io/packages/npm
GET /packages/npm
- Gets data from Redis based on the operation above.
curl -X GET fetch.customelements.io/packages/npm
{ "jorgecasar/input-password": { "npm": { "name": "input-password", "keywords": ["web-components"] } }, {...} }
GET /limit
Returns GitHub's API current rate limit.
curl -X GET fetch.customelements.io/limit
{ "limit": 5000, "remaining": 5000, "reset": 1427122269 }
License
MIT License © WebComponents.org
