Request Lifecycle
H3 dispatches incoming web requests to final web responses.
Below is an overview of what happens in a H3 server from when an HTTP request arrives until a response is generated.
1. Incoming Request
When An HTTP request is made by Browser or fetch(), server fetch handler receives a Request object.
2. Accept Request
H3 Initializes an H3Event instance from incoming request, calls onRequest global hook and finally H3.handler with the initialized event.
3. Dispatch Request
H3 matches route based on request.url and request.method, calls global middleware and finally matched route handler function with event.
🚀 Internally, H3 uses srvx
FastURL instead of new URL(req.url).pathname.4. Send Response
H3 converts returned value and prepared headers into a Response, calls onResponse global hook and finally returns response back to the server fetch handler.