In practicality, cookies are used to remember user name, session state, preferences and any other information that a web application wishes to keep on a client device.
So cookies are quite important for any web application or service. In this example, we'll set a single cookie (name of the user), and then we will retrieve it later. Very simple, but it's the foundation of what you'd need to do in pretty much any application.
First, in a separate directory, create an application "yum" (as in cookies are delicious):
gg -k yum
Copied!

Next, create this source code file "biscuit.golf" (for everyone outside the US who feels it should have been "biscuit" instead of "cookie"):
begin-handler /biscuit get-param action if-true action equal "enter-cookie" // Display a form to get cookie value @<h2>Enter your name</h2> @<form action="<<p-path "/biscuit">>" method="POST"> @ <input type="hidden" name="action" value="save-cookie"> @ <label for="cookie-value">Your name:</label><br/> @ <input type="text" name="cookie-value" value=""><br/> @ <br/> @ <input type="submit" value="Submit"> @</form> else-if action equal "save-cookie" // Submittal of form: save the cookie through response to the browser get-param cookie_value get-time to cookie_expiration year 1 timezone "GMT" set-cookie "customer-name" = cookie_value expires cookie_expiration path "/" @Cookie sent to browser! @<hr/> else-if action equal "query-cookie" // Web request that delivers cookie value back here (to server); display it. get-cookie name="customer-name" @Customer name is <<p-web name>> @<hr/> else-if @Unrecognized action<hr/> end-if end-handlerCopied!

The code is pretty easy: