1.0.4 • Published 6 years ago
petfinder-graphql v1.0.4
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