StoicBuilder

HandbookII the ForumHTTP methods

IIthe Forum, The shape of an app

HTTP methods

1 min readUpdated 28 November

In plain words

Every request carries a method that says what it wants: GET reads, POST creates, PUT or PATCH updates, and DELETE removes something.

Where you see it

The Method column in the Network tab shows GET as a page loads and POST when you place a QuickBite order. In a Next.js route file, each method is its own exported function named GET, POST or DELETE.

app/api/notes/route.tsserver
export async function GET() { return Response.json(await listNotes());} export async function POST(req: Request) { const note = await createNote(await req.json()); return Response.json(note, { status: 201 });}
Same address, two methods: GET lists the notes, POST adds one.

What goes wrong

  1. Deleting with a GET link

    Link previews, prefetching and crawlers follow GET links on their own. A GET that deletes can wipe data nobody meant to touch.

    <a href="/api/notes/42/delete">Delete</a>
  2. Putting a body on a GET request

    GET requests can't carry a body, and fetch throws an error if you try. Filters belong in the address instead, like /api/posts?author=maya.

  3. A method and a route that don't match

    The form sends POST but the route only exports GET, and the reply is 405 Method Not Allowed. The address is right; the verb is wrong.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
Use GET only for reading and never for anything that changes data; use POST, PATCH or DELETE for changes. List each API route with its method and what it does in one plain sentence.

Quick check

Sign in to earn +10 XP for it

Saving a note returns 405 Method Not Allowed. What does that tell you?

Got a prompt that touches HTTP methods?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.