This example demonstrates how to use WunderGraph with Next.js & Postgres. We are going to make your database accessible through JSON-RPC to your Next.js app.
Install the dependencies and run the complete example in one command:
npm install && npm start
After a while, a new browser tab will and you can start exploring the application. If no tab is open, navigate to http://localhost:3000.
You can start editing the page by modifying pages/index.js
. The page auto-updates as you edit the file.
API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.js
.
The pages/api
directory is mapped to /api/*
. Files in this directory are treated as API routes instead of React pages.
Read the Docs.
Join us on Discord!