0.0.0-ca3c6aa • Published 4 years ago

@nhl/api v0.0.0-ca3c6aa

Weekly downloads
9
License
-
Repository
-
Last release
4 years ago

NHL API Node.js Library

npm version install size npm downloads npm downloads

The NHL Node library provides convenient access to the Records and Stats API from applications written in server-side JavaScript.

This is an unofficial, Fan-made project, built for learning and discovery purposes of the exposed NHL APIs. Copyrights and Trademarks belong to their respective organization.

NHL and the NHL Shield are registered trademarks of the National Hockey League. NHL and NHL team marks are the property of the NHL and its teams. © NHL 2021. All Rights Reserved.

Table of Contents

Installation

You can add the library as a dependancy to your project using Yarn or NPM.

yarn add @nhl/api
# OR
npm install @nhl/api

Technical Prologue

This library is built by extending the functionality (and types) of the axios HTTP client library. It does the heavy lifting for you but it effectively is axios at it's core. This means you should find success in both browser and node environments, however server-side (Node.js) is the intended usage of the library and browser-specific bugs may not be prioritzed.

Usage

The entire API appears to be unauthenticated and can be consumed without the need for an access token of any sort.

JavaScript Example:

import { nhl } from '@nhl/api';

// Promises
nhl.positions.retrieve().then(response => {
  console.log(response.data)
})

// Async/Await
async function () {
  const response = await nhl.positions.retrieve()
  console.log(response.data)
}
[
  {
    abbrev: 'G',
    code: 'G',
    fullName: 'Goalie',
    type: 'Goalie',
  },
  {
    abbrev: 'D',
    code: 'D',
    fullName: 'Defenseman',
    type: 'Defenseman',
  },
  {
    abbrev: 'RW',
    code: 'R',
    fullName: 'Right Wing',
    type: 'Forward',
  },
  {
    abbrev: 'LW',
    code: 'L',
    fullName: 'Left Wing',
    type: 'Forward',
  },
  {
    abbrev: 'C',
    code: 'C',
    fullName: 'Center',
    type: 'Forward',
  },
  {
    abbrev: 'N/A',
    code: 'N/A',
    fullName: 'Unknown',
    type: 'Unknown',
  },
  {
    abbrev: 'Head Coach',
    code: 'HC',
    fullName: 'Head Coach',
    type: 'Coach',
  },
];
0.0.0-2ef4592

4 years ago

0.0.0-3feb21c

4 years ago

0.0.0-f0382fd

4 years ago

0.0.0-37f6d52

4 years ago

0.0.0-92d52d6

4 years ago

0.0.0-401fc02

4 years ago

0.0.0-29849e9

4 years ago

0.0.0-ca3c6aa

4 years ago