How to set a cookie that expires after a certain time using Tritium?

I would like to create a cookie that expires 5 minutes after a user visits my page.

I know about the add_cookie() function, but I have no idea how to set its expiration.

+4
source share
1 answer

You can set cookies in the scripts/response_main.ts file as follows:

 set_cookie("cookie_name", "cookie_val") cookie("cookie_name") { cookie.expires("Wed, 09 Jun 2021 10:18:14 GMT") } 

For more information, refer to this link .

+3
source

Source: https://habr.com/ru/post/1495430/


All Articles