301 Moved Permanently
This URL is permanently gone. Here is the new URL. Browsers and search engines will update their links automatically.
When and Why to Use It
Section titled “When and Why to Use It”Use this when you have permanently changed the URL of a page. This tells Google and other search engines ‘Forget the old URL, rank the new one instead’.
Usage Examples
Section titled “Usage Examples”import { HttpCode, get } from 'shokupan';
export const getResource = get('/resource', () => { return { message: 'Moved Permanently' };}).pipe(HttpCode(301));import { Controller, Get, HttpCode } from 'shokupan';
@Controller('/api')export class ExampleController { @Get('/resource') @HttpCode(301) getResource() { return { message: 'Moved Permanently' }; }}import express from 'express';const app = express();
app.get('/resource', (req, res) => { res.status(301).json({ message: 'Moved Permanently' });});import { Controller, Get, HttpCode } from '@nestjs/common';
@Controller('api')export class ExampleController { @Get('resource') @HttpCode(301) getResource() { return { message: 'Moved Permanently' }; }}import Koa from 'koa';const app = new Koa();
app.use(async ctx => { if (ctx.path === '/resource' && ctx.method === 'GET') { ctx.status = 301; ctx.body = { message: 'Moved Permanently' }; }});