top | item 22714645

(no title)

TXV | 6 years ago

Personally, I would still choose gin. Gin seems to be more straight to the point. To name one, compare goyave router.Route("PUT|PATCH", ...) with gin router.PUT() or router.PATCH(). Also I'm not a fan of adding a lot of functionality and opinionated behavior into web frameworks. e.g. configuration files that need to be in a specific place in my workdir, "automatic 404 when a database record is not found", etc.

But sure, if you want to get a server up and running from scratch very quickly for a POC or a simple API-over-a-database app, this lib might be a good starting point.

discuss

order

SystemGlitch|6 years ago

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.

hssys|6 years ago

Doesn't Gin still have big issues where it's not compatible with native net/http middleware?