A minimalistic zero-config GraphQL server
tbd
With yarn:
yarn add graphpack
With npm:
npm install graphpack
Add following run script to your package.json:
"scripts": {
"start": "graphpack"
},Add your type definitions under src/schema.graphql and add some example types in SDL:
type Query {
hello: String
}Add your resolvers under src/resolvers.js:
const resolvers = {
Query: {
hello: () => 'world!',
},
};
export default resolvers;If you prefer to write the type definitions in JS and parse the queries with graphql-tag, just save your schema as a JS file under
src/schema.js. It's also possible to create separate folderssrc/schema/index.jsandsrc/resolvers/index.js.