mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
f26a801775
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Daniel Roe <daniel@roe.dev>
812 B
812 B
title | description | links | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
setResponseStatus | setResponseStatus sets the statusCode (and optionally the statusMessage) of the response. |
|
Nuxt provides composables and utilities for first-class server-side-rendering support.
setResponseStatus
sets the statusCode (and optionally the statusMessage) of the response.
const event = useRequestEvent()
// Set the status code to 404 for a custom 404 page
setResponseStatus(event, 404)
// Set the status message as well
setResponseStatus(event, 404, 'Page Not Found')
::callout
In the browser, setResponseStatus
will have no effect.
::
:read-more{to="/docs/getting-started/error-handling"}