March 18, 2020
The best way to access cookies with an Express server is using the cookie-parser
middleware package.
Install it:
npm install cookie-parser
And then add it to your server:
const express = require("express")
const app = express()
const cookieParser = require("cookie-parser")
app.use(cookieParser())
// the rest of your Express server...
You can then access the cookies of any request:
app.get("/", (req, res) => {
const cookies = req.cookies
const token = req.cookies.token
// ...etc
})
Tufts Meal Plan Wrapped
Mar 2, 2024
Building an e-ink picture frame that displays an iCloud photo album
Jan 9, 2024
2023 in review
Jan 5, 2024
Subscribe to my newsletter for a monthly round-up of new blog posts and projects Iām working on!