Cookies
Gaman Cookies here the usage is quite simple, just use ctx.cookies and you can already manage cookies :)
ctx.cookies.set(key, value, options)
Section titled “ctx.cookies.set(key, value, options)”here is a simple example of creating cookies
(ctx) => { ctx.cookies.set('session', 'abogoboga', { secure: true, expires: 60 * 60 * 24 * 30 // 30 days })}ctx.cookies.get(key)
Section titled “ctx.cookies.get(key)”here is a simple example of getting cookie value
(ctx) => { const session = ctx.cookies.get('session') session.value // string value; session.json() // json value session.number() // number value session.boolean() // boolean value}ctx.cookies.has(key)
Section titled “ctx.cookies.has(key)”here is a simple example to check if cookie exists or not
(ctx) => { if(ctx.cookies.has('session')){ // TODO }}ctx.cookies.delete(key)
Section titled “ctx.cookies.delete(key)”here is a simple example to delete existing cookie
(ctx) => { ctx.cookies.delete('session')}