package main

import (
	"context"
	"fmt"

	"github.com/fastly/compute-sdk-go/fsthttp"
)

func main() {
	fsthttp.ServeFunc(func(ctx context.Context, w fsthttp.ResponseWriter, r *fsthttp.Request) {
		switch {
		case r.Method == fsthttp.MethodGet && r.URL.Path == "/robots.txt":
			w.WriteHeader(fsthttp.StatusOK)
			fmt.Fprintf(w, "User-agent: BadBot\nDisallow: /\n")
			return
		default:
			w.WriteHeader(fsthttp.StatusNotFound)
			fmt.Fprintln(w, "The page you requested could not be found")
			return
		}
	})
}