import { Router } from "@fastly/expressly";
const backend = "origin_0";
const router = new Router({ parseCookies: true });
router.use(async (req, res) => {
console.log(`Original Cookie header is "${req.headers.get('cookie')}"`);
req.cookies.delete("myCookie");
console.log(`Removed myCookie. Updated Cookie is "${req.headers.get('cookie')}"`);
let beresp = await fetch(req, { backend });
res.cookie('myCookie', 'foo', { path: "/", maxAge: 60 });
res.cookie('mySecondCookie', 'bar', { httpOnly: true });
res.headers.set('Cache-Control', 'no-store, private');
res.send(beresp);
});
router.listen();