Use cases
- REST APIs and microservices — Handle client requests and return responses directly from the edge
- Dynamic UIs and landing pages — Generate and serve content based on user interactions or geolocation
- AI-powered endpoints — Process images, run chat completions, or generate embeddings
- Backend functions for static frontends — Power contact forms, webhooks, and data submissions
- External API calls — Send emails, transform data, or integrate with third-party services
Benefits
By executing directly at the network’s edge, standalone scripts reduce latency significantly, enabling faster data processing and response times. They are inherently capable of handling multiple requests simultaneously without straining resources, facilitating smooth scalability as user demands increase.The serve function
The serve function starts an HTTP server that listens for incoming requests and handles them using the provided handler function.
Function signature
Handler
The handler function receives a standard Request object and must return a Response orPromise<Response>.