Anonymous View
1.0.0 • Published 8 years ago

tmdb-api-wrapper v1.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
8 years ago

tmdb-api

Yet another tmdb (themoviedb.org) API v3 wrapper written in functional fashion.

Installation

npm i tmdb-api - that's it, really

How to use

Examples

A TypeScript example:

import { api, TMDBExternalSources } from './functions/api'
import * as assert from 'assert'


main()
async function main() {
  try {
    const apiKey = process.env.NODE_TMDB_API_KEY
    assert.ok(apiKey, "NODE_TMDB_API_KEY not defined in your env! Giving up.")
    const proxy = process.env.NODE_TMDB_API_PROXY

    const id = "nm0000001"
    const res = await api(apiKey)
      .useProxy(proxy)
      .find(TMDBExternalSources.imdb)
      .byId(id)

    console.log(JSON.stringify(res, null, 2))
  } catch (err) {
    console.error(err)
  }
}```