How to set cookie in browser using loopback?

I'm just starting out with developing loopback, and I just want to know how to set cookies in a browser using loopback. You can send the cookie explicitly to nodejs by setting it in the headers and then accessing it later.

response.writeHead(200, {
    'Set-Cookie': 'mycookie=test',
    'Content-Type': 'text/plain'
  });

So how to do this with the return loop.

Thank.

+4
source share
2 answers

He had a simple solution. Using core node.js to solve it:

since we have a context in loopback, therefore:

context.res.setHeader("Set-Cookie",'cookie='+ cookieId);

This would also do a loopback trick.

+4
source

Loopback Express, cookie-session cookie Express, .

+2

All Articles