session

command
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

This sample demonstrates how to use sessions to maintain state across multiple requests. It implements a shopping cart where items persist between calls using the session API.

To run:

go run .

In another terminal, test (items persist across requests):

curl -X POST http://localhost:8080/manageCart \
  -H "Content-Type: application/json" \
  -d '{"data": "Add apples and bananas to my cart"}'

curl -X POST http://localhost:8080/manageCart \
  -H "Content-Type: application/json" \
  -d '{"data": "What is in my cart?"}'

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL