...

/

Solution: Set and View a Cookie

Solution: Set and View a Cookie

Go over the solution to set and view a cookie.

We'll cover the following...

Solution

The following is the complete implementation of the problem described here:

'use strict'

class TestController {
  setcookie({ response }) {
    response.cookie('product_id', 1201)
    return 'Cookie set'
  }
  getcookie({ request }) {
    return request.cookie('product_id')
  }   
}

module.exports = TestController
...