How it works...

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

Browsing http://localhost:8080/read will display Hello in the browser, as you can see in the following screenshot:

Next, we will access http://localhost:8080/create, which will create a cookie with the name first-cookie and display the Cookie created message in the browser:

Now, subsequent access to http://localhost:8080/read will use first-cookie to display Hello, followed by the value of first-cookie, as follows:

Let's understand the program ...

Get Go Web Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.