Controllers

Instead of defining all of your request handling logic as closures in your route files, you may wish to organize this behavior using "controller" files. By default, controllers are stored in the controllers directory.


Each controller must be contained within a directory of the same name, for example login > login.go

package login

import (
	"github.com/go-chi/chi/v5"
	"gozen/system/templates"
	"net/http"
)

func Index(w http.ResponseWriter, r *http.Request) {
	
	templates.Render(w, r, "login", data)
}