Comments (6)
I've now tried apollo with official integration with react that didn't work for me as I don't use react. I also attempted trying to pass in jwt bearer token and that resulted in jwt error when using apollo directly. I used env variable for hasura endpoint as a link.
const httpLink = createHttpLink({
uri: 'https://ybjelsmfvjhtzjaspgnr.graphql.eu-central-1.nhost.run/v1',
});
const authLink = setContext((_, { headers }) => {
// Get the authentication token from local storage if it exists
const token = 'abc';
// Return the headers to the context so httpLink can read them
return {
headers: {
...headers,
authorization: token ? `Bearer ${token}` : "",
}
}
});
const nhost = new ApolloClient({
link: authLink.concat(httpLink),
cache: new InMemoryCache(),
defaultOptions: {
query: {
fetchPolicy: 'no-cache',
},
watchQuery: {
fetchPolicy: 'no-cache',
},
},
});
from nhost.
I guess you could check how we do it in our dashboard:
https://github.com/nhost/nhost/blob/main/dashboard/graphql.config.yaml
https://github.com/nhost/nhost/blob/main/dashboard/package.json#L13
We also wrote a blog post about this topic some time ago:
https://nhost.io/blog/graphql-code-generator-maximizing-graphql-development-typescript
Hopefully this sets you in the right track.
from nhost.
I don't use react. Reason why that I mentioned prisma is that I believe that it must do things in a way that lets you get types without relying on some react preset however much I'm find with using apollo which is also pretty react. Can you at very least bother documenting how I'm suppose to connect to nhost WITHOUT the react or your nhost client that WILL NOT support typescript.
from nhost.
I still can't really tell how to use anything but nhost react because the API is undocumented.
from nhost.
While I understand we don't provide a tutorial using the SDK, you can find the JS/TS SDK reference documentation here:
https://docs.nhost.io/reference/overview#client-libraries
For instance:
https://docs.nhost.io/reference/javascript/auth/change-email
And you can find the API documentation here:
https://docs.nhost.io/reference/auth/sign-up-email-and-password
from nhost.
from nhost.
Related Issues (20)
- Hasura doesn't work HOT 3
- nhost project showing 404 HOT 1
- dashboard: allow configuring postmark's native integraton
- Feature Request: Choose Embedding Model HOT 16
- Feature Request: Add OTP for Email in Auth HOT 14
- dashboard: github connect: investigate potential UX improvements HOT 2
- dashboard: multiple error toasts closing together
- Custom Claim Array always null with auth 0.29.1 HOT 5
- dashboard: add model settings to autoembeddings configuration
- dashboard: e2e tests for Run and AI pages
- Error in signup/email-password HOT 2
- Never received any otp code, response is null on session and error
- Nhost (Next) JWT Token expire and apollo/nhostNext js client stops working HOT 19
- Can't Access Auth Endpoint HOT 1
- Change metadata for user in dashboard HOT 2
- evaluate project templates
- add "headers" option to missing methods in the js sdk
- error in openapi3filter.RequestError: refresh token is missing HOT 3
- react-apollo example e2e tests backend fails to start because of dummy secrets
- NextJS Server Components and Subscriptions Example HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nhost.