From d54364a895ca0def51ac7a51a9e3753122314bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20P=C3=B6hls?= Date: Tue, 14 Jun 2022 06:05:48 +0200 Subject: [PATCH] start documenting sessions --- navigation.js | 2 +- session.md | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/navigation.js b/navigation.js index 18779b0..43dba76 100644 --- a/navigation.js +++ b/navigation.js @@ -35,6 +35,7 @@ module.exports = { Responses: 'responses', Controllers: 'controllers', Middleware: 'middleware', + // Session: 'session', // 'CSRF Protection': 'csrf-protection', // 'Request Lifecycle': 'request-lifecycle', // Authentication: 'authentication', @@ -52,7 +53,6 @@ module.exports = { // Encryption: 'encryption', // Events: 'events', Logger: 'logger', - // Session: 'session', // Queues: 'queues' } }, diff --git a/session.md b/session.md index e00c29d..62b3ca0 100644 --- a/session.md +++ b/session.md @@ -2,11 +2,25 @@ ## Overview -Tba. +Sessions provide a way to transition HTTP application from being stateless to stateful. Stateful applications save information about users across multiple requests. For example, identifying users across requests is useful in session-based authentication. ## Configuration -Tba. +Your application’s session options are stored in the `config/session.ts` configuration file. This config file allows you to customize the default session driver and driver-specific configuration. + +By default, Supercharge uses the `cookie` driver to store session data. + + +### Available Session Drivers +Supercharge ships with different session backends. All session backends are access in a driver-based approach exposing the same interface. Following the same interface allows you to switch from one session backend to another by changing a single line of configuration: + +| Session Driver | Description | +|---------------- |--------------------------------------------- | +| `memory` | Stores session in memory, useful for testing | +| `cookie` | Stores the session data in a cookie | + +We welcome every contribution for new session drivers. You can submit a pull request adding a new driver or you may ask for an implementation by creating an issue [in the framework’s GitHub repository](https://github.com/supercharge/framework). + ## Interacting with the Session