Skip to content

Commit

Permalink
Merge branch 'release/1.0.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Aug 1, 2017
2 parents 6111c86 + 969a1e0 commit a7ff5fe
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 159 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
<a name="1.0.6"></a>
## [1.0.6](https://github.com/adonisjs/adonis-session/compare/v1.0.5...v1.0.6) (2017-08-01)


### Features

* **instructions:** add instructions file for ace ([959d3ce](https://github.com/adonisjs/adonis-session/commit/959d3ce))


### Reverts

* **command:** remove config:session command ([3387118](https://github.com/adonisjs/adonis-session/commit/3387118))



<a name="1.0.5"></a>
## [1.0.5](https://github.com/adonisjs/adonis-session/compare/v1.0.4...v1.0.5) (2017-07-31)

Expand Down
89 changes: 0 additions & 89 deletions commands/ConfigSession.js

This file was deleted.

20 changes: 20 additions & 0 deletions instructions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict'

/*
* adonis-session
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

const path = require('path')

module.exports = async function (cli) {
try {
await cli.makeConfig('session.js', path.join(__dirname, './templates/config.mustache'))
} catch (error) {
// ignore if session.js already exists
}
}
34 changes: 34 additions & 0 deletions instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Registering provider

Make sure to register the provider before you can make use of sessions. The providers are registered inside `start/app.js` file.

```js
const providers = [
'@adonisjs/session/providers/SessionProvider'
]
```

## Registering middleware

The next thing you should do is register the global middleware inside `start/kernel.js` file.

```js
const globalMiddleware = [
'Adonis/Middleware/Session'
]
```

## Using session

Once done with provider and middleware registeration, you can make use of the session by grabbing an instance from the HTTP request context.

```js
Route.get('/', async ({ session }) => {
session.get('username')
session.put('username', 'virk')
})
```

## Config

You can find the configuration inside `config/session.js` file. Feel free to tweak it as per your needs.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adonisjs/session",
"version": "1.0.5",
"version": "1.0.6",
"description": "This repo is the official session provider for Adonisjs apps. It supports multiple drivers to store session data.",
"main": "providers/SessionProvider",
"directories": {
Expand Down
File renamed without changes.
69 changes: 0 additions & 69 deletions test/config-command.spec.js

This file was deleted.

0 comments on commit a7ff5fe

Please sign in to comment.