Skip to content

409 Conflict

Your request conflicts with the current server state. E.g., trying to register a username that is already taken.

Use this for business logic conflicts. The most common example is trying to register a new account with an email address that is already in use.

import { HttpException, post } from 'shokupan';
export const registerUser = post('/register', async (req) => {
const existing = await db.users.findByEmail(req.body.email);
if (existing) {
throw new HttpException('Email already registered', 409);
}
// ... create user
});