3.2.3 • Published 1 year ago

hltv-api-gs v3.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

HLTV API mod special for GoStars

npm Codecov dependencies Status

This is the modification of the 'hltv-api'.

Installation

$ npm install hltv-api-gs

Methods

  1. getNews
  2. getResults
  3. getMatches
  4. getMatchById
  5. getTopPlayers
  6. getPlayerById
  7. getTopTeams
  8. getTeamById
  9. getEvent

How to use

Simple API example

  • Using CommonJS module:
const HLTV = require('hltv-api').default
const express = require('express')
const app = express()

app.get('/', async (req, res) => {
  const news = await HLTV.getNews()
  res.json(news)
})

app.listen(3000, () => {
  console.log('Listening on port 3000...')
})
  • Using babel and necessary plugins (demo app)
import HLTV from 'hltv-api-gs'

News

app.get('/', async (req, res) => {
  const news = await HLTV.getNews()
  res.json(news)
})

Results

app.get('/results', async (req, res) => {
  const results = await HLTV.getResults()
  res.json(results)
})

Matches

app.get('/matches', async (req, res) => {
  const matches = await HLTV.getMatches()
  res.json(matches)
})

Match Stats

app.get('/results/:matchId/stats', async (req, res) => {
  const stats = await HLTV.getMatchById(req.params.matchId)
  res.json(stats)
})

Top Players

app.get('/players', async (req, res) => {
  const players = await HLTV.getTopPlayers()
  res.json(players)
})

Player Stats

app.get('/players/:playerId', async (req, res) => {
  const player = await HLTV.getPlayerById(req.params.playerId)
  res.json(player)
})

Top Teams

app.get('/top-teams', async (req, res) => {
  const teams = await HLTV.getTopTeams()
  res.json(teams)
})

Single Team

app.get('/teams/:teamId', async (req, res) => {
  const team = await HLTV.getTeamById(req.params.teamId)
  res.json(team)
})

Single Event

  app.get('/events/:eventId', async (req, res) => {
  const event = await HLTV.getEvent(req.params.eventId)
  res.json(event)
})
3.2.3

1 year ago

3.2.2

1 year ago