> For the complete documentation index, see [llms.txt](https://docs.swift.cloud/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.swift.cloud/docs/platform/compute-runtime/listen-for-requests.md).

# Listen for Requests

All Swift Cloud applications start with listening for an incoming HTTP request. This is accomplished by calling `onIncomingRequest` in your main handler function:

```swift
import Compute

@main
struct App {
    static func main() async throws {
        try await onIncomingRequest(handleIncomingRequest)
    }

    static func handleIncomingRequest(req: IncomingRequest, res: OutgoingResponse) async throws {
        print("Handling request:", req.url.pathname)
    }
}
```
