Back to Nuxt

useRequestEvent

docs/4.api/2.composables/use-request-event.md

4.4.4328 B
Original Source

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

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

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

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