Giter Site home page Giter Site logo

api's Introduction

pubg.sh-api

The API component of https://pubg.sh. See also pubgsh/client.

Overview

This app provides a caching layer in front of the PUBG Official API and exposes the underlying data via GraphQL. It's responsible for parsing the retrieved data into a normalized schema and returning info about players and the matches they've participated in.

Running

Requirements

  • PostgresQL
  • Node version 8+
  • yarn

Configuration

  1. Create .env dotenv file in the root of the project and provide the following values:
  • HAPI_PORT (optional, defaults to 8080)
  • HOST (optional, defaults to 0.0.0.0)
  • PGUSER
  • PGHOST
  • PGPASSWORD
  • PGDATABASE
  • PUBG_API_KEY
  1. Manually run the test/seed.sql file against your database or enable the recreateDb() call in src/app.js

Running

Simply run yarn start and visit http://localhost:8080/graphiql to confirm it's up.

Testing

yarn run test or yarn run test:watch will run the test suite with Jest.

Note that the majority of tests will require an available PostgreSQL database. Each test will run in its own self-contained DB seeded with test/seed.sql and the DB will be dropped after the test.

Also note that some tests use global.__Fixture. This provides an easy way to automatically cache HTTP requests into a local __fixtures__ folder to ensure tests remain stable and don't require network connectivity when run in a CI environment. Toggling the mock option to true will cause requests to only be served from the file system cache. Setting mock to false will allow all outgoing HTTP Axios requets and then write their responses to the file system.

The fixture helper will automatically remove the Authorization header from being written to the FS. Be aware that any other sensitive information must have a manual exclusion added.

License

MIT

api's People

Contributors

apazzolini avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.