I other post I was using a private and public schema to return 401 http status. But I found a better solution to change the response http status from the server.
(you can read a better solution here)
The GraphQL Spec that defines how errors should be handled. That means Apollo Server cannot send 401 server error, each request sent http status 200. Even if you have an authenticate issue, it will return a JSON with http status 200. My plan to handle it is to create two shemas, one private and one public.
In this post I want to show you how to handle server errors like 404, 500, 403, etc. Also "Network Connection error" and validation errors u others.
In my previous post I published how to authenticate with Laravel + GraphQL. The current post is to know how run a private query using GraphiQL.
In my previous post I published a basic example with Laravel + GraphQL. The current post is to create the login query.
In this post I'm going to set up the environment to test the queries and mutations, and test the
langs query. It's the same query created in the previous post Basic example Laravel + GraphQL.
Laravel GraphQL is a implementation of GraphQL with PHP for Laravel. Very easy to install and use. So the plan in this post is to create
langs query and see it in Graphiql.
I created a different template for React with React Router 4. The idea is:
- Code flexible able to manage many layouts.
- Possibility to choose a different layout for any component or a layout for a group of components.
- If a user is not logged in the URL’s that required a login, then show the public layout with a login form.
- If the user is logged and their wants see the public page (like about-us), the layout must be the public layout with the possibility to see the private web page if click in a private URL.