Skip to content

405 Method Not Allowed

The URL exists, but you used the wrong HTTP verb. E.g., trying to POST to an endpoint that only accepts GET.

Use this if you have a POST /users endpoint, and someone accidentally tries to send a GET /users request to it.

import { HttpException, get } from 'shokupan';
export const getResource = get('/resource', () => {
throw new HttpException('Method Not Allowed', 405);
});