A node.js wrapper for the official API of the Ultimate Fighting Championship.
npm install ufc-api --save
var UfcAPI = require('ufc-api');
var ufc = new UfcAPI({
version: 'v3'
});
ufc.titleHolders(function(err, res) {
console.log(res.body);
// =>
// [
// {
// id: 1160,
// wins: 13,
// statid: 1494,
// losses: 4,
// last_name: "Jung",
// weight_class: "Featherweight",
// title_holder: true,
// draws: 0,
// first_name: "Chan Sung",
// fighter_status: "Active",
// thumbnail: "..."
// },
// ...
// ]
});When instantiating an API client, you can specify the API version by passing
an option. The version defaults to v3.
var UfcAPI = require('ufc-api');
var ufc = new UfcAPI({
version: 'v3'
});
The default API version has been changed from v1 to v3. There should not
be any breaking changes, and no action is required.
The module supports v1 and v3 API.
To see all the endpoints:
All callbacks take error as the first argument, and result as the second.
- This module uses babel to compile ES2015 code in
/libto/dist. Simply write code using ES2015 in/lib. - The test is run against the compiled code in
/dist. To run test, first runnpm run-script compile. And runnpm test. - Compilation is run automatically as a hook before publishing to npm.
MIT