Socket
Book a DemoInstallSign in
Socket

apollo-datasource-generic

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-datasource-generic

A generic implementaion of apollo datasource

latest
npmnpm
Version
0.5.1
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

apollo-datasource-generic

A generic implementaion of apollo datasource.

Install

npm install --save apollo-datasource-generic

or

yarn add apollo-datasource-generic

Usage

Define a data source by extending the GenericDataSource class.

const { fetchNewsSources, fetchNews } = require('example-news-api')

class TestDataSource extends GenericDataSource {
  constructor () {
    super('news:', 60)
  }

  getNewsSources () {
    return this.get('sources', fetchNewsSources, 60 * 60)
  }

  getNews (source) {
    return this.get(source, fetchNews)
  }
}

FAQs

Package last updated on 08 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts