0.1.0 ā¢ Published 4 years ago
@saeris/apollo-server-now v0.1.0
Note: These docs are subject to change, as this library is under construction. Expect things to be broken!
š¦ Installation
npm install --save graphql @saeris/apollo-server-now
# or
yarn add graphql @saeris/graphql-scalars
š§ Usage
import { ApolloServer, gql } from "@saeris/apollo-server-now";
// Construct a schema, using GraphQL schema language
const typeDefs = gql`
type Query {
hello: String
}
`;
// Provide resolver functions for your schema fields
const resolvers = {
Query: {
hello: () => 'Hello world!',
},
};
const server = new ApolloServer({
typeDefs,
resolvers,
// By default, the GraphQL Playground interface and GraphQL introspection
// is disabled in "production" (i.e. when `process.env.NODE_ENV` is `production`).
//
// If you'd like to have GraphQL Playground and introspection enabled in production,
// the `playground` and `introspection` options must be set explicitly to `true`.
playground: true,
introspection: true,
});
export default server.createHandler();
š„ License
Released under the MIT license.