News for hackers. Stuff that matters.

SystemGlitch

Show HN: Goyave v5 – Golang REST API framework

https://github.com/go-goyave/goyave

Goyave an opinionated all-in-one Golang web framework focused on REST APIs, with emphasis on code reliability, maintainability and developer experience.After two years of redesigning and rewriting the framework, this new major version is finally out with a refocused design and stronger architecture.

( Read More... | no comments | 2 points | on HN )
Re:Show HN: Goyave – Golang Web Framework on Sunday March 29, 2020 @05:22AM (#22717507)
I agree that config is quite weak in Goyave. I planned to rework it in a later major version. But I don't want to release breaking changes one by one.
Re:Show HN: Goyave – Golang Web Framework on Saturday March 28, 2020 @07:24PM (#22715090)
Fair point. The "automatic 404 when a database record is not found" is purely optional and something you choose to use or not, like all the other helpers. For example, see below code:

  func Show(response *goyave.Response, request *goyave.Request) {
    product := model.Product{}
    id, _ := strconv.ParseUint(request.Params["id"], 10, 64)
    result := database.GetConnection().First(&product, id)
    if response.HandleDatabaseError(result) {
      response.JSON(http.StatusOK, product)
    }
  }

"response.HandleDatabaseError" is the helper we're talking about.
Re:Show HN: Goyave – Golang Web Framework on Saturday March 28, 2020 @02:58PM (#22713441)
Thank you!

Yes there are quite a lot of features added to the package:

- Request validation

- Localization (for validation error messages and regular text)

- Authentication (with built-in Basic Auth and JWT authenticators, directly using your User model. You can easily implement your own authenticators too)

- CORS

- Status handlers (for default responses depending on the response status when the body is empty, handy for error handling)

- Logging (using Common or Combined log format. You can implement your own formatters too)

- Advanced testing with test suites making it easy to write functional tests, unit tests for your middleware, etc.

- Database testing with record generators and seeders

- Many helpers to make your life easier (that includes multi-values header parsing, file management, automatic 404 when a database record is not found, etc). There are a lot of small things!

- An extensive and pretty documentation. This aspect very important to me.

I try to make it as flexible as possible to let developers implement things for their specific needs without having to fork the framework.

Re:Show HN: Goyave – Golang Web Framework on Saturday March 28, 2020 @02:16PM (#22713067)
Goyave is slower than Gin but provides more features such as regex in routes, validation, language support, among others.
Re:Show HN: Goyave – Golang Web Framework on Saturday March 28, 2020 @02:13PM (#22713047)
You can give a path to your SSL cert in the config, and set "protocol" to "https" and you're done. If you're using Certbot, give the path to the live cert and it will work even after renewal.

About CSRF, as the framework is focused on APIs, the use of cookies is possible but not recommended, so you won't need CSRF protection when using Goyave.