Cookies — Basics · Hono

Keep state across requests the way a browser does: a session cookie set at login and read on every request, a preference cookie that outlives the session, and a logout that deletes one without touching the other.

What you will learn

Read the theory for Cookies

All Basics lessons

All Hono courses

loading types…

What you'll learn

  • Set a cookie with setCookie() from hono/cookie and choose its attributes: httpOnly, path, sameSite, maxAge
  • Read one cookie with getCookie(c, name) and all of them with getCookie(c)
  • Delete a cookie with deleteCookie(), which is a Set-Cookie that expires it, and see the jar in the request panel follow