docs(api): add useRequestEvent (#5326)

This commit is contained in:
Daniel Roe 2022-06-09 12:07:28 +01:00 committed by GitHub
parent 00844405ab
commit 775a904c77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,17 @@
# `useRequestEvent`
Nuxt provides composables and utilities for first-class server-side-rendering support.
Within your pages, components, and plugins you can use `useRequestEvent` to access the incoming request.
```js
// Get underlying request event
const event = useRequestEvent()
// Get the URL
const url = event.req.url
```
::alert{icon=👉}
In the browser, `useRequestEvent` will return `undefined`.
::