410 Gone
Like 404, but permanent. The resource is gone and is never coming back. Search engines should drop it immediately.
When and Why to Use It
Section titled “When and Why to Use It”Use this for APIs that have been permanently sunset and removed, or resources that were intentionally permanently deleted. It tells clients ‘Stop asking for this, forever’.
Usage Examples
Section titled “Usage Examples”import { HttpException, get } from 'shokupan';
export const getResource = get('/resource', () => { throw new HttpException('Gone', 410);});import { Controller, Get, HttpException } from 'shokupan';
@Controller('/api')export class ExampleController { @Get('/resource') getResource() { throw new HttpException('Gone', 410); }}import express from 'express';const app = express();
app.get('/resource', (req, res) => { res.status(410).json({ error: 'Gone' });});import { Controller, Get, HttpException } from '@nestjs/common';
@Controller('api')export class ExampleController { @Get('resource') getResource() { throw new HttpException('Gone', 410); }}import Koa from 'koa';const app = new Koa();
app.use(async ctx => { if (ctx.path === '/resource' && ctx.method === 'GET') { ctx.status = 410; ctx.body = { error: 'Gone' }; }});