Hi,
I need a reference to simple GraphQL application and to access the data thro Postman .
Thanks
Hi,
I need a reference to simple GraphQL application and to access the data thro Postman .
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Brahma Prakash ShuklaPosted Jun 23, 2023, 5:52 AM
To create a simple GraphQL application and access the data through Postman, you can follow these steps:
Set up a GraphQL server:
Use Postman to send GraphQL queries:
Here's a basic example of a GraphQL schema, resolver, and using Postman:
GraphQL Schema (schema.graphql):
type Book { id: ID! title: String! author: String! } type Query { books: [Book!]! }GraphQL Resolver (resolver.js):
const booksData = [ { id: '1', title: 'Book 1', author: 'Author 1' }, { id: '2', title: 'Book 2', author: 'Author 2' }, // ... more book objects ]; const resolvers = { Query: { books: () => booksData, }, }; module.exports = resolvers;Start the GraphQL server using Apollo Server (index.js):
const { ApolloServer, gql } = require('apollo-server'); const resolvers = require('./resolver'); const typeDefs = gql` // Paste your GraphQL schema here `; const server = new ApolloServer({ typeDefs, resolvers }); server.listen().then(({ url }) => { console.log(`Server running at ${url}`); });Use Postman to send GraphQL queries:
http://localhost:4000/graphql(assuming the server is running on port 4000).query { books { id title author } }This is a basic example to get you started with GraphQL and Postman. You can expand on this by adding mutations, connecting to a database, or incorporating more complex functionality based on your application's requirements.
Tuhin PaulPosted Jun 16, 2023, 2:04 AM
https://www.ezzylearning.net/tutorial/building-graphql-apis-in-asp-net-core
Check this article
Rajkiran SwainPosted Jun 15, 2023, 3:26 PM
Here are some reference links that can help you learn more about GraphQL and its implementation:
GraphQL.org: The official GraphQL website provides a comprehensive introduction, tutorials, and documentation: https://graphql.org/
GraphQL.js: The JavaScript reference implementation of GraphQL: https://github.com/graphql/graphql-js
Apollo GraphQL: A popular GraphQL platform that offers client and server libraries, tools, and resources: https://www.apollographql.com/
HowToGraphQL: A website that provides tutorials, examples, and best practices for building GraphQL APIs: https://www.howtographql.com/
GraphQL Cheat Sheet: A handy cheat sheet with commonly used GraphQL syntax and concepts: https://devhints.io/graphql
GraphQL with Node.js and Express: A tutorial on building a GraphQL server using Node.js and Express: https://www.robinwieruch.de/graphql-apollo-server-tutorial
GraphQL Playground: An interactive GraphQL IDE for exploring and testing GraphQL APIs: https://www.graphqlbin.com/
Postman Blog - GraphQL: A blog post on using Postman to test GraphQL APIs: https://blog.postman.com/testing-graphql-apis-using-postman/