---
title: HandlerFunc
summary: HandlerFunc adapts a function to a Handler.
url: https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/fsthttp/type.HandlerFunc/
---

**Kind:** Type alias  
**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#L137

```go
type HandlerFunc func(ctx context.Context, w ResponseWriter, r *Request)
```

Alias for `func(ctx context.Context, w ResponseWriter, r *Request)`.

HandlerFunc adapts a function to a Handler.

## Methods

### ServeHTTP

**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/fsthttp/handle.go#L140

```go
func (f HandlerFunc) ServeHTTP(ctx context.Context, w ResponseWriter, r *Request)
```

ServeHTTP implements Handler by calling f(ctx, w, r).

**Parameters**

- `ctx`: `context.Context`
- `w`: `ResponseWriter`
- `r`: `*Request`
