mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
docs(api): add useRequestEvent
(#5326)
This commit is contained in:
parent
00844405ab
commit
775a904c77
17
docs/content/3.api/1.composables/use-request-event.md
Normal file
17
docs/content/3.api/1.composables/use-request-event.md
Normal 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`.
|
||||||
|
::
|
Loading…
Reference in New Issue
Block a user