andrewarrow / feedback

golang webapp framework (rails inspired) with WASM, Effortless Migrations, Simple SQL that's NOT gorm, and Ultimate Routing Control

Home Page:https://andrewarrow.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feedback

This is a rails inspired golang framework that uses Settle Down as its demo app.

Look at main.go to see how to use feedback.

  r.Paths = map[string]func(*Context, string, string){}
  r.Paths["models"] = handleModels
  r.Paths["sessions"] = handleSessions
  r.Paths["users"] = handleUsers
  r.Paths["about"] = handleAbout

This is the heart of the routing code. You can have three levels of:

/foo/

/foo/bar/

/foo/bar/more/

That's why each top level path takes a func with two strings. Some of the paths you get built in to feedback like sessions and users since every app will need that logic.

But notice in main.go how this app adds more routes.

func HandleSomething(c *router.Context, second, third string) {
  if second == "" {
    c.SendContentInLayout("something_index.html", nil, 200)
  } else if third != "" {
    c.NotFound = true
  } else {
    c.NotFound = true
  }
}

Each controller has a HandleSomething func like this.

About

golang webapp framework (rails inspired) with WASM, Effortless Migrations, Simple SQL that's NOT gorm, and Ultimate Routing Control

https://andrewarrow.dev/

License:MIT License


Languages

Language:Go 68.6%Language:HTML 14.9%Language:JavaScript 9.1%Language:Python 3.7%Language:mupad 3.2%Language:CSS 0.5%