How make graphql apollo query request inside controller, but not component?
In RTK query we can just use something like initiate for example, but what about apollo?
Can we make request outside component somewhere on controller?
You can use client.query() to run a query outside of a React component. [docs]
Related
I'm moving all my non-graphql endpoints to GraphQL using Apollo.
One of these endpoints requires a server side redirect instead of returning data to the client.
Currently, I use express and do res.redirect but I cannot see a way to get access to the res object with Apollo. Is it possible to get it in the resolver context maybe?
Is there any chance I can do that using Apollo Server?
Here is one simple solution
First Step: Add Context while creating the apollo server object
Second Step Then access res object in your resolver context.res.redirect
here is my collection data
How to show this collection data in Vue file.
Please help me
Install the Axios package at the Vue side (at the frontend).
Then send an API request using Axios from Vue component to backend, and this API should return the response you have mentioned.
Now, use this response in the Vue component.
See this example
Can somebody tell me if is possible to modify Request object in Laravel before it is used by aplication.
I need to remove specific url segment call App::setLocale() and then create Request instance. It should be something like a middleware which has to be called between Aplication and Request. Is it possible to do it?
I made my first component with Vue, it's adding data to database, but it also getting datas from get axios. My questions is, how to secure axios get request? Because if any user go to http://localhost/get-data/ he will get JSON output with data on computer screen. How to prevent that?
I'm using Laravel for backend and Vue for frontend
you should use api authentication,
you have two way:
use laravel api-authentication ( add api-key field in your user table and send it for any request )
use laravel passport ( recommended )
I want to create a Rest API with Laravel, and on API controller i want to execute a particular Graphql schema, for example:
When I call this API
http://127.0.0.1:8000/flight
I want that the API to execute this schema: query{flight{flightNumber}}
ps: I want them both to execute in the same project.