-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #197 from alphagov/session
add session support
- Loading branch information
Showing
4 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Storing data in session | ||
|
||
**Advanced topic** | ||
|
||
If you need to store data for each user, the best way to do it is using session data. | ||
|
||
This means that if more than one person is using your prototype, their data will not get mixed up. | ||
|
||
The easiest way to clear session data is to use 'Incognito mode' for each user, and close that window when you're done. | ||
|
||
## How to use | ||
|
||
In a route function, refer to `req.session`. | ||
|
||
For example you might have `req.session.over18` or `req.session.firstName`. | ||
|
||
You can see a full example here: | ||
|
||
[https://github.com/expressjs/session#example](https://github.com/expressjs/session#example) | ||
|
||
You can read more about Express Session here: | ||
|
||
[https://github.com/expressjs/session](https://github.com/expressjs/session) |
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
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