PostgreSQL Example
The Postgresql example shows how to use WunderGraph with PostgreSQL.
For databases like Postgresql, MySQL, SQLite, SQLServer, MongoDB, CockroachDB and Planetscale, WunderGraph is able to directly speak GraphQL to your Database. We automatically introspect your database and generate a GraphQL Schema, you don't have to manually code a backend.
That said, you can always use hooks to add additional business logic, or even add custom GraphQL resolvers to decouple the clients from the database.
Configuration
First, let's add Postgresql as a data source. Simply point WunderGraph to your database using the connection string.
Define an Operation
The GraphQL schema is generated automatically. Next, we can define our Operation. Let's query all messages.
Call the generated RPC Endpoint
And we're done!