HTTP Methods
HTTP Methods are also known as HTTP which signifies the action to be performed on a resource.
- GET: This method is used to request a representation of specified resource. GET method is used for data retrieval.
- POST: It is a method which is used to submit an entity to the specified resource. POST method submits the data to processed, causing a change in state on the server.
- To get better understanding difference between the GET and POST you can refer this.
- GraphQL server handles HTTP GET and POST methods for operations. Usually we use GET for Query and POST for Mutation.
Serving GraphQL over HTTP
HTTP or Hypertext Transfer Protocol, is the foundation of Web communication. Being a stateless protocol, each request from a client to the server is independent and doesn’t retain information about past requests. GraphQL is a query language for APIs and a runtime for executing those queries.
Unlike traditional REST APIs with fixed endpoints and predefined structures, GraphQL allows clients to request the specific data they need on the same endpoint.
One common way to serve GraphQL is over HTTP, providing an efficient and flexible means of communication between client and server. In this article, we’ll explore how we can use the HTTP protocol to serve GraphQL and how it differs from traditional RESTful approaches.