Currently I am writing a web application, and I use net/http for most of the tasks and it seems sufficient. But the advice around web seems to be for web frameworks. Can someone tell me what are the advantages I will be getting using a framework, rather than net/http?
I don't want to start a religious war over this. I am sure both have pros/cons - but what are they?
评论:
deusmetallum:
SeerUD:The frameworks will have solved a lot of problems for you, such as sessions, csrf, logging, etc. However, if you don't need those problems solved, then net/http is absolutely fine.
A lot of the time, Gophers are steered away from web frameworks. More often than not you don't need everything they provide, and would find you're better off just piecing together some libraries and making some decisions yourself. I'd tend to agree, because you'll find that approach is generally more flexible.
That's not always the case though; and frameworks can solve a lot of really common problems. It just depends on if you want to work within the constraints of a given framework. It really depends on what you're building though.
