Node version : Node v6
NPM version : npm v5
npm install apollo-server-express graphql graphql-tools express mongoose --save
- Add
playground: true
to server creation script and that will allow to open graghiql playground while running the query.
var express = require('express');
var { ApolloServer } = require('apollo-server-express');
var typeDefs = require('./src/graphql/schema')
var resolvers = require('./src/graphql/resolver')
require('./src/config/index');
const app = express();
const server = new ApolloServer({ typeDefs, resolvers, playground: true, });
server.applyMiddleware({ app, path: '/graphql' });
app.listen({ port: 3000 }, function () {
console.log('Server started...')
})
- Grahql Apollo Express Server Integration
- Schema & Resolvers Implementation
- Saclar Type Implementation
- Queries & Examples
- express - For Express Server
- bcrypt - For Encyption
- body-parser - For parsing
- graphql - For Query API
- mongoose - To manage relationships with data and schema for MongoDB
- apollo-server-express - For Graphql Connection with Express Server
Feel free to reach out through LinkedIn or Stack overflow !!