Connect session store whose storage is through remote REST API
npm install connect-remoteconnect-remote is a session store backed by any compatbile remote RESTful API service.
Setup
-----
``sh
`
npm install connect-remote express-session
express-session
Pass the store into connect-remote to create a RemoteStore constructor.
`
js
`
var session = require('express-session');
var RemoteStore = require('connect-remote')(session);
app.use(session({
store: new RedisStore(options),
secret: 'keyboard cat',
resave: false
}));
uri
Options
-------
A compatbile remote RESTful API URI is required. It is passed directly using the param.
uri
- Remote service uri
timeout
The following additional params may be included:
- Value used for timeout option in Request (defaults to 100).
destroy
Compatbile remote RESTful API service
-----
This stores implement below functions:
* : By DELETE method agasint uri ${uri}/${session_id}.
get
* : By GET method agasint uri ${uri}/${session_id}.
set
* : By PUT method agasint uri ${uri}/${session_id} with session data as request body.
all
* : By GET method agasint uri ${uri}/.
clear
* : By DELETE method agasint uri ${uri}/.
length
* : By GET method agasint uri ${uri}/count.
touch
* : By POST method agasint uri ${uri}/${session_id} with session data as request body.
data
All service response should be a JSON with attribute that containing the result.
`
json
``
// RESTful API response sample for get method
{
"data": {
"cookie": {
"originalMaxAge": 3600000,
"expires": "2019-02-26T06:20:10.358Z",
"httpOnly": true,
"path": "/"
}
}
}
// RESTful API response sample for length method
{
"data": 5
}
License
=======
MIT