domain | grodnolen.gov.by |
summary | **Summary:**
In programming, particularly in JavaScript and its frameworks like Node.js, `cookies` are a key component of web development. They serve the purpose of storing small pieces of data on the client-side (user's device) for use during subsequent requests to the same domain.
Here are some key points about cookies:
- **Purpose**: Cookies help maintain stateful sessions, remember user preferences, and store temporary information. - **Data**: Cookies can store strings up to approximately 4KB. They contain a name-value pair along with attributes like expiration date and path. - **Accessibility**: Cookies are accessible to both the client-side (JavaScript) and server-side (Node.js). - **Persistence**: Cookies have an expiration date. If none is set, they become session cookies which expire when the user closes their browser. - **Security**: To protect against cross-site scripting (XSS) attacks, it's recommended to use secure (HttpOnly) and same-site attributes.
Here's how you can create, read, and delete cookies using Node.js with Express:
```javascript // Create a cookie res.cookie('username', 'John Doe', { maxAge: 900000 });
// Read a cookie const username = req.cookies.username; // John Doe
// Delete a cookie res.clearCookie('username'); ```
To summarize, cookies are an essential tool for managing user-specific data across different requests in web development. |
title | Home - the administration of the Leninsky district of the city of Grodno |
description | Home - the administration of the Leninsky district of the city of Grodno |
keywords | cookies |
upstreams |
|
downstreams |
|
nslookup | A 93.125.24.158 |
created | 2025-03-26 |
updated | 2025-05-14 |
summarized | 2025-05-14 |
|
|