I want to use cookie-parser in expressjs, but typescript can't find the type of request.cookie. How can I solve it?
screenshot
ExpressJS Online Training Now to use cookies with Express, we will require the cookie-parser. cookie-parser is a middleware which parses cookies attached to the client request object. To use it, we will require it in our index. js file; this can be used the same way as we use other middleware.
The cookie parser parses cookies and puts the cookie information on req object in the middleware. It will also decrypt signed cookies provided you know the secret.
Just make sure that you've imported Request
type from express package instead of native request declaration type.
import {Request} from 'express';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With