Skip to content
Sample code for The Odds API in NodeJS
JavaScript Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
Dockerfile
README.md
package-lock.json
package.json
sample.js

README.md

The Odds API Code Samples (v3) - NodeJS

The Odds API provides live odds for loads of sports from bookmakers around the world, in an easy to use JSON format.

Before getting started, be sure to get a free API key from https://the-odds-api.com

For more info on the API, see the docs


Get Started

node sample.js YOUR-API-KEY-HERE

This will print:

  • A list of in-season sports
  • Events and odds for the next 8 upcoming games (across all sports)
  • Requests used & remaining for your api key

To change the sport, region and market, see the top of sample.js

Make sure the axios library is installed npm install axios

Running sample.js once will use 1 request from the quota.




Using Docker (Mac and Linux)

Build the image

docker build -t theoddsapi/sample:latest .

Run the node script in the container

docker run -t -i --rm -v "$(pwd)":/usr/src/app/ theoddsapi/sample:latest node sample.js YOUR-API-KEY-HERE
You can’t perform that action at this time.