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.
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:
Can you elaborate a bit on what features were added on top of the standard library or other popular libraries? A lot of this stuff is very similar to viper (configuration), mux (routing), gorm (database), so I'm wondering if there are additional features on top of those, or maybe the goal was to wrap it all into a single framework for ease of use?
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.
I'm not a fan of non-standard-lib compatible routers. I understand why the op chose to do so, but it doesn't jive with being able to change the implementation later. I'm a fan of Chi for routing and it it compatible with the standard lib. I'm def in the camp of pulling in libraries vs full frameworks.
That said, there is always room for improvement for the development workflow, especially for rapid prototyping. I'd be interested in a side by side comparison between this and the other batteries-included web frameworks such as Gin, Buffalo, Beego, Revel, and the standard lib.
Those validation rules are scary to look at. They are cryptic strings that express some limited form of logic in that can only be verified at runtime. Is this the state of the art for Go?
Prefer toml over yaml. Large Yaml files are a nightmare to edit with all the special spacing. JSON might be comment unfriendly but it is easily editable.
They just need to have a version of JSON with comments: JSONC and JSON is good.
As a heavy YAML user for a while (writing and maintaining Open API Spec files), YAML is also a catastrophe. I should not have to "debug" a config file because some tiny whitespace issue is off.
JSON as config isn't good, but YAML is not a silver bullet.
Integration with auto cert would be really nice. That is usually the biggest chunk in the body of my Go servers' main functions.
Edit: Is it also easy to hook up a CRSF middleware?
I guess that's my pain point with modern web development. Most cool features need SSL, you should add CSRF protections, gotta pick a good password hashing algorithm. I know how to do it but it's a bunch of tedious work when I just want to hack something together. Would love a framework that streamlines all that.
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.
TXV|6 years ago
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.
SystemGlitch|6 years ago
hssys|6 years ago
Jemaclus|6 years ago
Very interesting project. Good job. :)
SystemGlitch|6 years ago
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.
eyegor|6 years ago
https://github.com/kataras/iris/blob/master/README.md
mosen|6 years ago
https://github.com/avelino/awesome-go/pull/1137
http://www.florinpatan.ro/2016/10/why-you-should-not-use-iri...
faizmokhtar|6 years ago
sethammons|6 years ago
That said, there is always room for improvement for the development workflow, especially for rapid prototyping. I'd be interested in a side by side comparison between this and the other batteries-included web frameworks such as Gin, Buffalo, Beego, Revel, and the standard lib.
partisan|6 years ago
dougbarrett|6 years ago
sneak|6 years ago
Everything that can read json has the ability to read yaml. Please use yaml instead.
lenkite|6 years ago
They just need to have a version of JSON with comments: JSONC and JSON is good.
smt88|6 years ago
JSON as config isn't good, but YAML is not a silver bullet.
SystemGlitch|6 years ago
atraac|6 years ago
hombre_fatal|6 years ago
TACIXAT|6 years ago
Edit: Is it also easy to hook up a CRSF middleware?
I guess that's my pain point with modern web development. Most cool features need SSL, you should add CSRF protections, gotta pick a good password hashing algorithm. I know how to do it but it's a bunch of tedious work when I just want to hack something together. Would love a framework that streamlines all that.
SystemGlitch|6 years ago
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.
masa331|6 years ago
dylkil|6 years ago
SystemGlitch|6 years ago
derekdb|6 years ago
shagabutdinov|6 years ago