Building Web Applications with Go (Part 1)

in #steemstem6 years ago (edited)

Go is a fairly nice little language to use to build micro-services and web applications. In this tutorial series, I will cover building a web application from scratch using the core libraries of the Go language.

In this first tutorial, we look at how we can create handlers and serve information from text documents that are on the localhost. We also look at how we can take strings and convert them into HTML to be able to format the data that we are displaying on the server. From there, we will look at some of the basic conventions that are used to create HTML templates using the Go template engine. Our handlers will cover creating and using GET, PUT and POST requests in Go's standard library.

The source code for this project can be found here

(Note: this is an older tutorial series however, it is still completely relevant for the current version of Golang; 1.9).

Sort:  

hello friend very good post I like very much I follow you and vote, I leave you my most recent post of interest if you could see them and vote them I would really appreciate it, regards

this is my new project I hope you like it

https://steemit.com/steemit/@srmit/my-new-project-mavenezuela-community

you always have great content

I am glad you enjoy it.

Always a fan of go

Yeah, Go is a great little language. Easy to learn and very productive.

The only thing I didn't like about go was, as you said, it's anti-idiomatic to use frameworks. Often when I'm getting a prototype together I want something I can quickly build things with even if they're built poorly or slowly, rather than taking the time to roll my own. If I wanted something production ready I'd be more apt to reach for an older, or, more safe language. Go exists in a very unique space in my opinion.

It may not be idiomatic to use frameworks in Go but there are plenty of them if you want to follow a pattern. The basic style that comes with the net/http library is fairly straight forward and fast to prototype in. I actually find it fairly easy to prototype in a language like Go as opposed to something like Rails but maybe that's just me.

Frameworks like Rails and Django maybe more battle tested but Go has been around long enough to prove its muster and has been in production for rather large projects as well (since google uses it for a lot of things). Not to mention that Go naturally uses a level of concurrency that requires a lot of work in some of these other more mainstream frameworks.

That being said, I would tend towards using Go for Microserves and smaller applications because that is where it really shines (Serverless and Lambda style stuff). If I wanted to build something that had a ton of different features then one of these "batteries included" frameworks would be the obvious choice.

Well said, 100% agree.

Coin Marketplace

STEEM 0.17
TRX 0.14
JST 0.028
BTC 58083.18
ETH 2578.52
USDT 1.00
SBD 2.42