petfinder-graphql

1.0.4 • Public • Published

npm version

This package provides a GraphQL schema for the Petfinder.com API. You will need to register an account to get an API key Here

Installation

$ npm install petfinder-graphql

Usage

const schema = require('petfinder-graphql')('API_KEY_HERE');
 
//Sample using apollo-server-express
const express = require('express');
 
// This package automatically parses JSON requests.
const bodyParser = require('body-parser');
 
// This package will handle GraphQL server requests and responses
// for you, based on your schema.
const {graphqlExpress, graphiqlExpress} = require('apollo-server-express');
 
var app = express();
app.use('/graphql', bodyParser.json(), graphqlExpress({schema}));
 
app.use('/graphiql', graphiqlExpress({
  endpointURL: '/graphql'
}));
 
const PORT = 3000;
app.listen(PORT, () => {
  console.log(`GraphQL server running on port ${PORT}.`)
});

Testing

$ npm test

Readme

Keywords

Package Sidebar

Install

npm i petfinder-graphql

Weekly Downloads

2

Version

1.0.4

License

MIT

Unpacked Size

23.8 kB

Total Files

14

Last publish

Collaborators

  • bglaz