4
0
Fork
You've already forked frms
0
No description
  • Go 100%
2024年03月22日 03:31:31 -04:00
cmd/server Adds forms SQL table, seed data, and /test route 2024年03月22日 03:23:30 -04:00
pkg Adds forms SQL table, seed data, and /test route 2024年03月22日 03:23:30 -04:00
testdata/db/forms Updates README 2024年03月22日 03:31:31 -04:00
.editorconfig Initial commit 2024年03月19日 01:05:49 -04:00
.gitignore Adds forms SQL table, seed data, and /test route 2024年03月22日 03:23:30 -04:00
go.mod Adds sqlite as well as db and handlers pkgs 2024年03月22日 01:15:51 -04:00
go.sum Adds sqlite as well as db and handlers pkgs 2024年03月22日 01:15:51 -04:00
README.md Updates README 2024年03月22日 03:31:31 -04:00

frms

No bullshit 1-file forms.

Developing

You'll need the following tools:

If you modify any of the *.templ files in pkg/templs then you need to generate the new *.go files for them before compiling.

❯ templ generate -path ./pkg/templs
Processing path: /Users/erik/Code/limeleaf/frms/pkg/templs
Generating production code: /Users/erik/Code/limeleaf/frms/pkg/templs
(✓) Generated code for "/Users/erik/Code/limeleaf/frms/pkg/templs/layout.templ" in 1.420083ms
(✓) Generated code for 1 templates with 0 errors in 1.599417ms

Running

> go run ./cmd/server

Open http://localhost:3000

Seeding Database

The ./testdata/db directory contains seed data. All directories within db will be created as tables (provided there are .json files within) and each .json file will be inserted as an individual row within those tables. The ID of the row will be the name of the file without the extension.

If you want to seed the database with some data you can run:

❯ go run ./cmd/server --db-seed-dir ./testdata/db

Feel free to add more .json files for more data. To re-seed a new databse just delete the database file on disk first or else you'll see key contraint errors.