---
title: Serve
summary: Serve calls h, providing it with a context that will be canceled when Serve returns, a Request representing the incoming client request that initiated this execution, and a ResponseWriter that can be used to respond to that request. Serve will ensure the ResponseWriter has been closed before returning, and so should only be called once per execution.
url: https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/fsthttp/fn.Serve/
---

**Kind:** Function  
**Module:** [fsthttp](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/fsthttp/)  
**Package:** compute-sdk-go v1.11.0  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/handle.go#L18

```go
func Serve(h Handler)
```

Serve calls h, providing it with a context that will be canceled when Serve
returns, a Request representing the incoming client request that initiated
this execution, and a ResponseWriter that can be used to respond to that
request. Serve will ensure the ResponseWriter has been closed before
returning, and so should only be called once per execution.

**Parameters**

- `h`: `Handler`
