Unverified Commit 38e45f25 authored by Tyler Lutz's avatar Tyler Lutz Committed by GitHub

Add app router example (#52066)

- Add app router example to 03-environment-variables.mdx
Co-authored-by: 's avatarDelba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Co-authored-by: 's avatarSteven <229881+styfle@users.noreply.github.com>
parent 202dcb0e
...@@ -48,9 +48,20 @@ export async function getStaticProps() { ...@@ -48,9 +48,20 @@ export async function getStaticProps() {
<AppOnly> <AppOnly>
This loads `process.env.DB_HOST`, `process.env.DB_USER`, and `process.env.DB_PASS` into the Node.js environment automatically allowing you to use them in Route Handlers. This loads `process.env.DB_HOST`, `process.env.DB_USER`, and `process.env.DB_PASS` into the Node.js environment automatically allowing you to use them in [Route Handlers](/docs/app/building-your-application/routing/router-handlers).
{/* TODO: App Router Example */} For example:
```js filename="app/api/route.js"
export async function GET() {
const db = await myDB.connect({
host: process.env.DB_HOST,
username: process.env.DB_USER,
password: process.env.DB_PASS,
})
// ...
}
```
</AppOnly> </AppOnly>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment