dajk / hltv-api

DEPRECATED: An unofficial JSON api for popular CS:GO website hltv.org. Check available methods on https://hltv-api.vercel.app/
http://npm.im/hltv-api
MIT License
277 stars 59 forks source link

not running locally #87

Closed SanjaySRocks closed 2 years ago

SanjaySRocks commented 2 years ago

Installed hltv api and express

E:\Downloads\HLTVAPI\node_modules\hltv-api\dist\matches.js:74
            throw new Error(error);
                  ^
Error: Error: There are no matches available, something went wrong. Please contact the library maintainer on https://github.com/dajk/hltv-api
    at Object.<anonymous> (E:\Downloads\HLTVAPI\node_modules\hltv-api\dist\matches.js:74:19)
    at Generator.next (<anonymous>)
    at fulfilled (E:\Downloads\HLTVAPI\node_modules\hltv-api\dist\matches.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
PS E:\Downloads\HLTVAPI>

Throws this error which I hit

http://localhost:3000/matches

Code:-

const HLTV = require('hltv-api').default
const express = require('express')
const app = express()

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

app.listen(3000, () => {
  console.log('Listening on port 3000...')
})
dajk commented 2 years ago

Try again and feel free to re-open if the latest release it not fixing the issue..closing