No description
Find a file
2024-12-19 08:09:05 -07:00
cmd/dev_server feat: factor out chi from handlers package 2024-12-17 14:53:13 -07:00
db feat: factor out chi from handlers package 2024-12-17 14:53:13 -07:00
handlers fix: ListForms public API relies on internal package 2024-12-19 08:09:05 -07:00
internal feat: factor out chi from handlers package 2024-12-17 14:53:13 -07:00
routers/frmchi fix: ListForms public API relies on internal package 2024-12-19 08:09:05 -07:00
static initial commit 2024-12-16 17:01:53 -07:00
types initial commit 2024-12-16 17:01:53 -07:00
ui feat: factor out chi from handlers package 2024-12-17 14:53:13 -07:00
utils initial commit 2024-12-16 17:01:53 -07:00
.air.toml initial commit 2024-12-16 17:01:53 -07:00
.envrc initial commit 2024-12-16 17:01:53 -07:00
.gitignore initial commit 2024-12-16 17:01:53 -07:00
env.sample initial commit 2024-12-16 17:01:53 -07:00
flake.lock initial commit 2024-12-16 17:01:53 -07:00
flake.nix feat: factor out chi from handlers package 2024-12-17 14:53:13 -07:00
frm.go fix: ListForms public API relies on internal package 2024-12-19 08:09:05 -07:00
go.mod initial commit 2024-12-16 17:01:53 -07:00
go.sum initial commit 2024-12-16 17:01:53 -07:00
gomod2nix.toml initial commit 2024-12-16 17:01:53 -07:00
README.md feat: factor out chi from handlers package 2024-12-17 14:53:13 -07:00
sqlc.yaml initial commit 2024-12-16 17:01:53 -07:00
types.go feat: factor out chi from handlers package 2024-12-17 14:53:13 -07:00

frm

frm is an embeddable HTML form builder for Go. Its goal is to be embeddable within any net/http-comptabile http router.

This is a work in progress and not production-ready

Concepts

frm's design is oriented around the concept of "workspaces". Workspaces may represent users or tenants within your application. As such, every interaction with frm must be workspace-aware.

Usage

chi

frm mounts to a chi.Router instance and uses the WorkspaceIDUrlParam name to look up the workspace that requests belong to.

Example

const chiUrlParamName = "frm_workspace_id"
f, err := frm.New(frm.Args{
	PostgresURL:         os.Getenv("POSTGRES_URL"),
	WorkspaceIDUrlParam: chiUrlParamName, // name of the chi URL parameter name
})
if err != nil {
	panic(err)
}
err = f.Init(context.Background())
if err != nil {
	panic(err)
}
frmchi.Mount(chiRouter, fmt.Sprintf("/frm/{%s}", chiUrlParamName), f)

This mounts frm to a router at /frm/{frm_workspace_id}.

Inspiration

This project is heavily inspired by opnform. OpnForm is very good, and if you don't have an embeddable in Go requirement, then you should consider OpnForm instead.