1.0.0 • Published 1 year ago

wardhunter v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

WardHunter Client

WardHunter is a Nodejs library for interacting with the Riot Games API. It is designed to be a simple and easy to use library for developers to use to create their own applications.

This is a school project for the french CDA degree. It is not meant to be used in production.

Installation

You first need to setup a postgresql database. You can use supabase to do so. I recommand to use the local version of supabase, you can find the instructions here.

You can alternatively use a local postgresql database, with docker for example.

Use the package manager npm to install dependencies.

As this package uses prisma, you need to install it as a dev dependency.

npm i -D prisma

Then you can install the package.

npm i wardhunter

Setup

You need to create a .env file at the root of your project, with the following variables:

DIRECT_URL=your_direct_url
DATABASE_URL=your_database_url

For supabase users, this file should look like this:

DIRECT_URL=postgres://postgres:postgres@localhost:5432/postgres
DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres?pgbouncer=true

Usage

import { init, WardHunterClient } from "wardhunter";

// create a new client
const client = new WardHunterClient({
  apikey: process.env.RIOT_API_KEY, // recommended to use an env variable
});

// init the database with champions and few matches
client.init()
  .then(({ champions, matches }) => {
    // you have access to the champions and matches arrays
    console.log(`Added ${champions.length} champions and ${matches.length} matches to the database`);
  })
  .catch(console.error);

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT