Skip to content
A GraphQL schema and server wrapping SWAPI.
JavaScript HTML Shell
Branch: master
Clone or download
This branch is 20 commits ahead of graphql:master.

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cache
doc/example_queries
handler
public
scripts
src
.babelrc
.dockerignore
.eslintrc
.flowconfig
.gitignore
.prettierrc
.travis.yml
CONTRIBUTING.md
LICENSE-examples
README.md
Taskfile.yml
app.json
docker-compose.yml
index.d.ts
netlify.toml
package.json
rollup.config.js
schema.graphql
yarn.lock

README.md

SWAPI GraphQL Wrapper Schema

npm

This is a fork of the official Star Wars GraphQL API repo. This fork is necessary because of the following problems with that repo's npm package (swapi-graphql):

  • The published package has not been updated in a long time and does not track the repo's current code.
  • The schema it exports is unusable because it has a direct dependency on graphql, which leads to "multiple instances of GraphQL found" error messages.
  • Its postinstall hook causes installation with Yarn v2 to fail, probably because of Plug-n-Play.

This fork publishes a package called swapi-graphql-schema whose default export is the GraphQL schema.

Installation

npm install swapi-graphql-schema or yarn install swapi-graphql-schema.

Usage

This is typical usage with express-graphql:

import express from "express";
import graphqlHTTP from "express-graphql";
import schema from "swapi-graphql-schema";

const app = express();

app.use(
  "/graphql",
  graphqlHTTP({
    schema,
  })
);

app.listen(5000);

Publish

This repo uses go-task as the task runner.

  • Run task npm-auth to log in to npm. This only needs to be run once and your npm credentials will be stored in a local Docker volume.
  • Run task publish to publish the package.
You can’t perform that action at this time.