Skip to Main Content
Level Up Your Web Apps With Go
book

Level Up Your Web Apps With Go

by Mal Curtis
April 2015
Intermediate to advanced content levelIntermediate to advanced
260 pages
5h 17m
English
SitePoint
Content preview from Level Up Your Web Apps With Go

Chapter 6Gophr Part 3: Remembering Our Users

Last chapter we created our registration form, learned how to create users, and persist them to disk to avoid losing them between server restarts. We still have to cover how to keep them logged into Gophr. Since HTTP is a stateless protocol—in that it fails to remember anything about you from one request to the next—we use another means to track users between requests: cookies.

In this chapter, we’ll create a session system that lets users log in and out of Gophr at their discretion. To do this, we assign users a session that we store on the server side. Each session has a unique identifier, which is returned to the user in a cookie so that we can match the cookie in the request to the session. The ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Go: Building Web Applications

Go: Building Web Applications

Nathan Kozyra, Mat Ryer

Publisher Resources

ISBN: 9781457192845Errata Page