graphql-server-apollo-example
I've created an example of a GraphQL server using Apollo GraphQL server. I hope it can be useful to someone who is learning GraphQL with Apollo https://www.apollographql.com/docs/apollo-server/
Install dependencies
npm install
Run the example
node index.js
Deploying using Glitch
You can run the server code in glitch. It has been tested to be working fine. You can fork the repository in your github account and import the repo in glitch. Glitch is free hosting for nodejs code.
Here is the full code in this example:
const { ApolloServer, gql } = require('apollo-server')
const typeDefs = gql`
type Job {
id: Int
position: String
company: String
description: String
location: String
employmentType: String
skillsRequired: [String]
}
type Query {
job(id: Int!): [Job],
jobs: [Job]
}
`;
const jobs = [
{
id: 1,
position: 'Software Engineer',
company: 'Apple',
description: 'job description',
skillsRequired: ['Go', 'GraphQL'],
location: 'location',
employmentType: 'full-time',
},
{
id:
…