Sessions
Create a main.go
file and copy-paste the following code snippets:
Controller
The
VisitController.Session
is automatically binded to the currentsessions.Session
.The
VisitController.StartTime
is statically set to the server's start time with.Register(time.Now())
above.
Run
Open a terminal session and execute:
Prepare a client, e.g. your browser
navigate to http://localhost:8080
refresh the page some times
close the browser
re-open the browser (if it wasn't in private mode) and re-play 2.
Last updated