COMPUTER ENGINEER

Blog
Next.js / ASP.NET Core / SQL6 min study
02/ 41

The big picture

Client, server and the request/response cycle

Every interaction on the web is a request and the response to it.

UnderstandStudy an examplePractise

Understand the concept

The client starts a request; the server waits and responds. A browser is a client, but the Next.js server is also a client when it calls the API. Roles are defined by the relationship at that moment, not by the kind of program.

An HTTP request carries a method (GET, POST, PUT, DELETE…), a target path, headers and an optional body. A response has a status code (200, 404, 500…), headers and a body. ‘Safe’ methods such as GET must not change server state, which is why browsers, caches and crawlers can repeat them freely.

On the server each request is handled independently and often hundreds run at once. Server code must therefore be careful with shared state: an object created for one request must never leak into another user’s request.

WHEN TO USE IT

The method you choose directly affects caching, retries and security.

COMMON PITFALL

Deleting or changing data with GET; even a link previewer can trigger it.

01 / PRACTICE

One topic. Three levels of depth.

Illustrative example
GET /api/posts/ilk-yazi HTTP/1.1
Host: api.example.test

HTTP/1.1 200 OK
Content-Type: application/json

{"title":"İlk yazı"}

The simplest cycle: one request, one response.

This page connects to no real server or database. Code samples are illustrative for .NET 8, Next.js and SQL Server; timings are example values in the simulation, not measurements. Try samples only in your own development environment; never share real connection strings, tokens or passwords.

02 / YOUR TURN

Try it yourself first.

An unsubscribe link is e-mailed as ‘GET /unsubscribe?id=5’ and some users say they were unsubscribed without clicking. Why?

Show the solution and explanation
Worked solution
E-posta güvenlik tarayıcıları ve bağlantı önizleyicileri GET bağlantılarını otomatik açar.
Çözüm: GET ile onay sayfası göster, iptali POST ile yap.

Because GET is considered safe, automated tools call it freely. State-changing actions must use POST.