func ExtensionsRouter(appCtx appctx.ApplicationContext, registrationService core.RegistrationService, renderingService *rendering.EventRenderingService) http.Handler {
	router := chi.NewRouter()
	router.Use(middleware.AccessLogMiddleware())
	router.Use(middleware.AllowIfExtensionsEnabled)
	router.Use(middleware.AppCtxMiddleware(appCtx))
	registerHandler := handler.NewAgentRegisterHandler(registrationService)
	router.Post("/extension/register",
		registerHandler.ServeHTTP)
	router.Get("/extension/event/next",
		middleware.AgentUniqueIdentifierHeaderValidator(
			handler.NewAgentNextHandler(registrationService, renderingService)).ServeHTTP)
	router.Post("/extension/init/error",
		middleware.AgentUniqueIdentifierHeaderValidator(
			handler.NewAgentInitErrorHandler(registrationService)).ServeHTTP)
	router.Post("/extension/exit/error",
		middleware.AgentUniqueIdentifierHeaderValidator(
			handler.NewAgentExitErrorHandler(registrationService)).ServeHTTP)
	return router
}
ExtensionsRouter returns a new instance of chi router implementing
Extensions Runtime API specification.
package rapi
import (
	"net/http"
	"go.amzn.com/lambda/appctx"
	"go.amzn.com/lambda/rapi/handler"
	"go.amzn.com/lambda/rapi/middleware"
	"go.amzn.com/lambda/telemetry"
	"github.com/go-chi/chi"
	"go.amzn.com/lambda/core"
	"go.amzn.com/lambda/rapi/rendering"
)
func NewRouter(appCtx appctx.ApplicationContext, registrationService core.RegistrationService, renderingService *rendering.EventRenderingService) http.Handler {
	router := chi.NewRouter()
	router.Use(middleware.AppCtxMiddleware(appCtx))
	router.Use(middleware.AccessLogMiddleware())
	router.Use(middleware.RuntimeReleaseMiddleware())
	router.Get("/ping", handler.NewPingHandler().ServeHTTP)
	router.Get("/runtime/invocation/next",
		handler.NewInvocationNextHandler(registrationService, renderingService).ServeHTTP)
	router.Post("/runtime/invocation/{awsrequestid}/response",
		middleware.AwsRequestIDValidator(
			handler.NewInvocationResponseHandler(registrationService)).ServeHTTP)
	router.Post("/runtime/invocation/{awsrequestid}/error",
		middleware.AwsRequestIDValidator(
			handler.NewInvocationErrorHandler(registrationService)).ServeHTTP)
	router.Post("/runtime/init/error",
		handler.NewInitErrorHandler(registrationService).ServeHTTP)
	return router
}