Skip to content

Instantly share code, notes, and snippets.

@uen
Created September 9, 2020 21:46
Show Gist options
  • Save uen/f8bbded0fc10fd2d3910d388cd3fea6e to your computer and use it in GitHub Desktop.
Save uen/f8bbded0fc10fd2d3910d388cd3fea6e to your computer and use it in GitHub Desktop.
Express React native cookie test
const express = require("express");
const app = express();
const port = 3400;
app.get("/", (req, res) => {
// Set the cookie header, redirect to api that returns the cookie header
res.set("Set-Cookie", "TestCookie=a:hello,b:goodbye"); // Notice the comma
res.redirect("/my-cookies");
});
app.get("/my-cookies", (req, res) => {
res.end(`Your cookie header: ${req.header("Cookie")}`);
});
app.listen(port, () => {
console.log(`Listening on port ${port}`)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment