mantis-app
Version:
M.A.N.T.I.S (MongoDB, Analog, Nx, Tailwind CSS, Ionic, Storybook) is not just a CLI tool; it's your passport to a seamless full-stack project launch.
37 lines (35 loc) • 842 B
text/typescript
import { rest } from 'msw';
import { Todo } from '../services/todos.service';
export const defaultTodoHandlers = [
rest.get('/todos', (_, res, ctx) =>
res(
ctx.json([
{
_id: '1',
title: 'Learn Mantis',
completed: true,
},
{
_id: '2',
title: 'Ship your awesome app',
completed: false,
},
{
_id: '3',
title: 'Tell everyone about Mantis',
completed: false,
},
] satisfies Todo[]),
),
),
rest.post('/todos', (req, res, ctx) =>
res(
ctx.json({
_id: Date.now().toString(),
...req.json(),
}),
),
),
rest.patch('/todos/:id', (req, res, ctx) => res(ctx.json(req.json()))),
rest.delete('/todos/:id', (req, res, ctx) => res(ctx.status(200))),
];