Search.../

notFound( )

Returns a response with a status code 404 (Not Found) and instructs the router to show a 404 page.

Description

The notFound() function is used in the router(), beforeRouter(), and afterRouter() hooks to indicate that the requested page was not found. Optionally, you can pass a message that otherwise defaults to "Not Found".

Syntax

function notFound([message: string]): Promise<WixRouterResponse>

notFound Parameters

NAME
TYPE
DESCRIPTION
message
Optional
string

The message to show.

Returns

Fulfilled - A response object with HTTP status code 404.

Return Type:

Was this helpful?

Create a not found response

Copy Code
1import {notFound} from 'wix-router';
2
3export function myRouter_Router(request) {
4
5 return notFound();
6}