www: cleanup miscellaneous doc items (#1419)

This commit is contained in:
Reed von Redwitz
2023-07-07 16:07:40 +02:00
committed by GitHub
parent 7aad800ced
commit f737e1c4e3
14 changed files with 449 additions and 39 deletions
+4 -4
View File
@@ -35,7 +35,7 @@ full files are available at the bottom for reference.
`POST` (create) is used to create a resource.
```tsx
// /routes/api/index.ts
// routes/api/index.ts
export const handler: Handlers<User | null> = {
async POST(req, _ctx) {
const user = await req.json() as User;
@@ -72,7 +72,7 @@ You should receive the same thing back:
method. You can use `GET` to fetch database content, markdown, or static files.
```tsx
// /routes/api/[id].ts
// routes/api/[id].ts
export const handler: Handlers<User | null> = {
async GET(_req, ctx) {
const id = ctx.params.id;
@@ -103,7 +103,7 @@ The short version of it: `PUT` requires the entire object to be submitted, while
An example of an update endpoint using `PUT`:
```tsx
// /routes/api/[id].ts
// routes/api/[id].ts
export const handler: Handlers<User | null> = {
async PUT(req, ctx) {
const id = ctx.params.id;
@@ -153,7 +153,7 @@ No need to send in the id in this case.
`DELETE` (delete) is used to delete a resource.
```tsx
// /routes/api/[id].ts
// routes/api/[id].ts
export const handler: Handlers<User | null> = {
async DELETE(_req, ctx) {
const id = ctx.params.id;