Movie API with Graphql
]$ yarn global add babel-cli --ignore-engines
]$ yarn add babel-cli babel-preset-env babel-preset-stage-3 --dev
# https://github.com/prisma/graphql-yoga
]$ yarn add graphql-yoga
]$ yarn global add nodemon
]$ yarn add node-fetch
OR
]$ yarn add axios
"scripts": {
"start": "nodemon --exec babel-node index.js"
}
{
"presets": ["env", "stage-3"]
}
# Over-fetching : Get all data that is not use.
# Under-fetching : Get not enough data. Request many times. Need to call many times to complete resource.
Can ask infomation what you want
// Resolve the Query(Nodejs do something to functionality)
const resolvers = {
Query: {
name: () => "nicolas",
},
};
type Query {
// use ! when is required
name: String!
}
type Mutation {
addMovie(name: String!, score: Int!): Movie!
}