Web Request Pipeline
- The web request pipeline refers to the sequence of steps that occur when a client requests a web server.
- The server then processes the request and sends a response to the client.
- The pipeline includes the steps such as routing, authentication, authorization, request handling, and response generation.
- Modern web frameworks use the pipeline architecture which involves various middleware components and requests pass through them.
- Requests which can be inspected, transformed, modified or even terminated in the pipeline.
- GraphQL should be placed after authentication middleware or module. This is to provide access to the same session and user information in the HTTP endpoint.
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.