How to use moviedb-promise - 2 common examples

To help you get started, we’ve selected a few moviedb-promise examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mjrode / WhatToWatch / server / services / moviedb / movieDbApi.js View on Github external
import config from '../../../config';
import helpers from '../helpers';
import models from '../../db/models';
import MovieDb from 'moviedb-promise';
import stringSimilarity from 'string-similarity';

const mdb = new MovieDb(config.server.movieApiKey);

const popularTv = async () => {
  try {
    const response = await mdb.miscPopularTvs();
    return response;
  } catch (error) {
    helpers.handleError(error, 'popularTv');
  }
};

const topRatedTv = async () => {
  try {
    const response = await mdb.miscTopRatedTvs();
    return response;
  } catch (error) {
    helpers.handleError(error, 'miscTopRatedTvs');
github mjrode / WhatToWatch / server / services / plex / importData.js View on Github external
import Promise from 'bluebird';
import plexApi from './plexApi';
import models from '../../db/models';
import config from '../../../config';
import MovieDb from 'moviedb-promise';
import logger from '../../../config/winston';
import { Op } from 'sequelize';
const mdb = new MovieDb(config.server.movieApiKey);

const updateOrCreate = async (model, where, newItem) => {
  const item = await model.findOne({ where });
  if (!item) {
    const createItem = await model.create(newItem, {
      returning: true,
      plain: true,
      raw: true,
    });
    return { createItem, created: true };
  } else {
    await model.update(
      newItem,
      { where: where },
      { returning: true, plain: true, raw: true },
    );

moviedb-promise

A library for interacting with themoviedb.org API using Promises

MIT
Latest version published 4 months ago

Package Health Score

65 / 100
Full package analysis

Popular moviedb-promise functions