From 4b18dc8b7968898fe0848796feb68f3513cd7064 Mon Sep 17 00:00:00 2001 From: Reed von Redwitz Date: Mon, 10 Jul 2023 08:47:58 +0200 Subject: [PATCH] www: fix file locations in comments of crud api (#1438) --- docs/examples/creating-a-crud-api.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/examples/creating-a-crud-api.md b/docs/examples/creating-a-crud-api.md index 7e7b37cb..62497783 100644 --- a/docs/examples/creating-a-crud-api.md +++ b/docs/examples/creating-a-crud-api.md @@ -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/users/index.ts export const handler: Handlers = { 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/users/[id].ts export const handler: Handlers = { 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/users/[id].ts export const handler: Handlers = { 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/users/[id].ts export const handler: Handlers = { async DELETE(_req, ctx) { const id = ctx.params.id;