How would you implement a general web app using Go?


How would you implement a general web app using Go?

Whenever I want to make a web applications, I always get stuck writing the API endpoints. It seems that writing APIs involves writing a wholelot of boilerplate, which I hate to write. A lot of functionality seems reusable too. What solutions do people here use?

Generally, my web applications need the following features: authentication and authorization (login, register, account recovery, …), rate limiting, pagination, other WHERE clauses (since data is fed from a DB).

Would you use a RESTful API using JSON responses? Would you use a (g)RPC approach (or why not)? WebSocket is only useful if there is not a request-response type of communication, but streaming or message passing. The authentication part could be done using http://ift.tt/1NoByy7. But what about all these endpoints for all your methods? So much boilerplate, also clientside. I quite like how in gRPC you can define a protocol and reuse those client side (I don't get why browser support was considered so late though).

Concluding, it would be nice to have a standard solution for a web application that could be reused. Does anybody have examples?

Submitted July 14, 2017 at 04:08AM by tdewolff
via reddit http://ift.tt/2t8i1n3

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s