biothings-explorer-graphql

2.1.2 • Public • Published

Biothings Explorer GraphQL

npm Build Status Coverage Status
GraphQL app for BioThings Explorer

Example Usage

See example/ for a complete usage example.

Making Queries

Visit the wiki page on Forming and Executing Queries for more info.

Integrate into existing Express server (recommended)

Install

  1. npm install biothings-explorer-graphql graphql
  2. npm install express (ignore this step if express is already installed)

Integrate Into Server

Add the following lines to your express server. (Wrap everything in an async function if top level await is not available.)
By default, it will be served on the /graphql path.

const getServer = require("biothings-explorer-graphql");
 
const server = await getServer();
server.applyMiddleware({ app });

To serve it on a different path, use

server.applyMiddleware({ app, path: "/your-path" });

To pass other parameters to ApolloServer, pass a config object to the getServer function. (Refer to documentation for other options)

See example/ for an example using more advanced options.

const config = {
    //enable introspection and playground in production 
    //(these options will be injected into the ApolloServer constructor after the `typeDefs` and `resolvers` are automatically passed in)
    introspection: true,
    playground: true,
};
const server = getServer(config);

Run as a Vanilla Standalone Server

Install

  1. git clone https://github.com/ericz1803/biothings_explorer_graphql.git
  2. cd biothings_explorer_graphql/
  3. npm install
  4. npm install graphql express

Start Server

npm start

Run Tests

npm run test

Package Sidebar

Install

npm i biothings-explorer-graphql

Weekly Downloads

1

Version

2.1.2

License

ISC

Unpacked Size

29.7 kB

Total Files

8

Last publish

Collaborators

  • ericz1803