Skip to content

201 Created

Success! The request worked and resulted in a brand new resource being created (e.g., a new user account).

Use this specifically when a POST or PUT request actually creates a brand new record in your database. It’s best practice to also include a ‘Location’ header pointing to the new resource’s URL.

import { HttpCode, get } from 'shokupan';
export const getResource = get('/resource', () => {
return { message: 'Created' };
}).pipe(HttpCode(201));