Is Echo v3 compatible with http.HandlerFunc?


#1

Our team is building a REST API with Echo v3 and would like to know is it compatible with Go’s native http handler.

The reason behind is that AWS recently started to support Go runtime in Lambda, and we want to move to serverless infrastructure with minimum code changes.

Projects such as Apex Gateway provides drop-in replacement of Go net/http, so it would be great Echo v3 could do that as well.

Example of https://github.com/apex/gateway

package main

import (
	"fmt"
	"log"
	"net/http"
	"os"

	"github.com/apex/gateway"
)

func main() {
	http.HandleFunc("/", hello)
	log.Fatal(gateway.ListenAndServe(":3000", nil))
}

func hello(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintln(w, "Hello World from Go")
}

BTW Echo is awesome!


#2

@tomodian Have you looked into Echo#WrapHandler?