Created
September 9, 2020 21:46
-
-
Save uen/f8bbded0fc10fd2d3910d388cd3fea6e to your computer and use it in GitHub Desktop.
Express React native cookie test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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