302 Found
Historically ‘Moved Temporarily’. The resource is at a different URL for now. Future requests should still use the original one.
When and Why to Use It
Section titled “When and Why to Use It”Use this for temporary redirects. For example, if your site is under maintenance, you might 302 redirect users to a ‘We will be right back’ temporary holding page.
Usage Examples
Section titled “Usage Examples”import { HttpCode, get } from 'shokupan';
export const getResource = get('/resource', () => { return { message: 'Found' };}).pipe(HttpCode(302));import { Controller, Get, HttpCode } from 'shokupan';
@Controller('/api')export class ExampleController { @Get('/resource') @HttpCode(302) getResource() { return { message: 'Found' }; }}import express from 'express';const app = express();
app.get('/resource', (req, res) => { res.status(302).json({ message: 'Found' });});import { Controller, Get, HttpCode } from '@nestjs/common';
@Controller('api')export class ExampleController { @Get('resource') @HttpCode(302) getResource() { return { message: 'Found' }; }}import Koa from 'koa';const app = new Koa();
app.use(async ctx => { if (ctx.path === '/resource' && ctx.method === 'GET') { ctx.status = 302; ctx.body = { message: 'Found' }; }});