rsnext/examples/with-msw/mocks/handlers.ts
Steven 4466ba436b
chore(examples): use default prettier for examples/templates (#60530)
## Description
This PR ensures that the default prettier config is used for examples
and templates.

This config is compatible with `prettier@3` as well (upgrading prettier
is bigger change that can be a future PR).

## Changes
- Updated `.prettierrc.json` in root with `"trailingComma": "es5"` (will
be needed upgrading to prettier@3)
- Added `examples/.prettierrc.json` with default config (this will
change every example)
- Added `packages/create-next-app/templates/.prettierrc.json` with
default config (this will change every template)

## Related

- Fixes #54402
- Closes #54409
2024-01-11 16:01:44 -07:00

26 lines
959 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { rest } from "msw";
import { Book, Review } from "./types";
export const handlers = [
rest.get("https://my.backend/book", (_req, res, ctx) => {
return res(
ctx.json<Book>({
title: "Lord of the Rings",
imageUrl: "/book-cover.jpg",
description:
"The Lord of the Rings is an epic high-fantasy novel written by English author and scholar J. R. R. Tolkien.",
}),
);
}),
rest.get("/reviews", (_req, res, ctx) => {
return res(
ctx.json<Review[]>([
{
id: "60333292-7ca1-4361-bf38-b6b43b90cb16",
author: "John Maverick",
text: "Lord of The Rings, is with no absolute hesitation, my most favored and adored book byfar. The trilogy is wonderful and I really consider this a legendary fantasy series. It will always keep you at the edge of your seat and the characters you will grow and fall in love with!",
},
]),
);
}),
];