Use Response.json() to return JSON data. It automatically sets the Content-Type header to application/json. Return a JSON object with a message field set to "Hello from API!".
You can also parse JSON from request bodies using await request.json(). This is useful for POST requests that send data.
Use Response.json() to return JSON data. It automatically sets the Content-Type header to application/json. Return a JSON object with a message field set to "Hello from API!".
You can also parse JSON from request bodies using await request.json(). This is useful for POST requests that send data.