NewStaticController (solid/controller.go)

iota-sdk · pkg/lens/render/solid/controller.go · go · Apache-2.0
integration

Static HTTP controller serving bundled assets with versioned caching and immutable headers.

// Source: https://github.com/iota-uz/iota-sdk | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package solid

import (
	"net/http"
	"strings"

	"github.com/gorilla/mux"
	"github.com/iota-uz/iota-sdk/pkg/application"
	"github.com/iota-uz/iota-sdk/pkg/serrors/serrorhttp"
)

const immutableCacheControl = "public, max-age=31536000, immutable"
const staticRouteName = "lens.react.assets"

type StaticController struct {
	basePath string
	handler  http.Handler
	// versionedHandler is nil when the bundle is read from disk: the revision
	// changes on every rebuild, so the prefix is resolved per request instead.
	versionedHandler http.Handler
}

var _ application.Controller = (*StaticContro

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key