Request Processing
Cookie Parsing
Parse and manage cookies with support for signed cookies and secure cookie handling for authentication and preferences.
Basic Cookie Parsing
MoroJS provides built-in cookie parsing middleware with support for signed cookies and secure cookie handling.
Enable Cookie Parsing
typescript
Cookie Features
- Automatic cookie parsing from requests
- Support for signed cookies
- Secure cookie flags (httpOnly, secure, sameSite)
- Cookie expiration management
- Cookie deletion support
Advanced Configuration
Advanced Cookie Configuration
typescript
Best Practices
Do
- Use signed cookies for sensitive data
- Set httpOnly flag for security
- Use secure flag in production
- Set sameSite: 'strict' for CSRF protection
- Use strong cookie secrets
- Set appropriate expiration times
Don't
- Store sensitive data in unsigned cookies
- Skip httpOnly flag for sensitive cookies
- Use weak cookie secrets
- Set very long expiration times
- Store large objects in cookies
- Trust client-side cookie values