Nuxt/docs/3.api/2.composables/use-request-event.md
2024-02-21 18:09:45 +01:00

603 B

title description links
useRequestEvent Access the incoming request event with the useRequestEvent composable.
label icon to size
Source i-simple-icons-github https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/composables/ssr.ts xs

Within the Nuxt context you can use useRequestEvent to access the incoming request.

// Get underlying request event
const event = useRequestEvent()

// Get the URL
const url = event?.path

::tip In the browser, useRequestEvent will return undefined. ::