-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update nextjs guides #8281
base: master
Are you sure you want to change the base?
update nextjs guides #8281
Conversation
…sphinx directives + add go domain (#8218)
Create an API route and fetch data from the client side: | ||
|
||
.. code-block:: tsx | ||
:caption: pages/api/posts.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should update this to be an app-router Route Handler, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking to have two options there - with app router and with pages router. I'll make it clear in the title.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to support the pages router still? There is nothing particularly special about this code, and if we show an app router Route Handler, it should be pretty easy for someone two write the equivalent pages router API route, I would think.
docs/guides/tutorials/nextjs.rst
Outdated
Deployment | ||
----------- | ||
|
||
First, add a ``prebuild`` script to your ``package.json`` to generate the query builder during deployment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move this to gel.toml
hooks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But don't we need this, too? So that t works with a cloud provider when building the app. As I understand, the hooks will work after applying the migration etc, so if I deploy to e.g. Vercel and connect to the Cloud with env variables, it won't run the generator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, good point, we should do both. We probably need some additional direction to get it to even work during deployment since it needs access to a live database. I think it works fine in the Vercel integration which I'm pretty sure sets the EDGEDB_INSTANCE
and EDGEDB_SECRET_KEY
environment variables correctly.
Maybe this section should be merged into the sections below?
docs/guides/tutorials/nextjs.rst
Outdated
Using EdgeDB in Next.js | ||
----------------------- | ||
|
||
EdgeDB with React Server Components (App Router) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we show both server components and server actions?
Docs preview deploy❌ Docs preview deployment failed for commit d7339b2: https://edgedb-docs-9bl28msen-edgedb.vercel.app (Last updated: Feb 19, 2025, 17:15:47 UTC) |
Since we will have a new quickstart tutorial for building apps with Next.js, I merged our two existing Next.js tutorials into a short guide showing the setup and basics of using EdgeDB with Next.
related PR: https://github.com/edgedb/edgedb.com/pull/955