Skip to content
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

Add app router example #52066

Merged
merged 7 commits into from
Jul 6, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,20 @@ export async function getStaticProps() {

<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).
styfle marked this conversation as resolved.
Show resolved Hide resolved

{/* TODO: App Router Example */}
For Example:
delbaoliveira marked this conversation as resolved.
Show resolved Hide resolved

```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>

Expand Down