hltv-api-gs
v3.2.3
Published
modified API from Hltv.org special for GoStars
Downloads
3
Readme
HLTV API mod special for GoStars
This is the modification of the 'hltv-api'.
Installation
$ npm install hltv-api-gs
Methods
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)
})