O'Reilly logo

Go Web Development Cookbook by Arpit Aggarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works…

Once we run the program, the HTTP server will start locally listening on port 8080.

Browsing http://localhost:8080 will show us the Hello Foo! served by the template engine, as shown in the following screenshot:

Execute curl -X GET http://localhost:8080 from the command line as:

$ curl -X GET http://localhost:8080

This will result in the following response from the server:

Let's understand the Go program we have written:

  • type Person struct { Id string Name string }: Here we define a person struct type that has Id and Name fields. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required