Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/espimarisa/session-rethinkdb-ts
A modern RethinkDB session store for Express.
https://github.com/espimarisa/session-rethinkdb-ts
express express-session rethinkdb session session-store typescript
Last synced: 21 days ago
JSON representation
A modern RethinkDB session store for Express.
- Host: GitHub
- URL: https://github.com/espimarisa/session-rethinkdb-ts
- Owner: espimarisa
- License: mit
- Created: 2021-01-12T03:27:26.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-09-07T11:29:04.000Z (2 months ago)
- Last Synced: 2024-10-15T03:05:23.777Z (about 1 month ago)
- Topics: express, express-session, rethinkdb, session, session-store, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/session-rethinkdb-ts
- Size: 162 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# session-rethinkdb-ts
A RethinkDB express-session store.
## Maintenance Mode
This package is in maintenance mode and will only receive security and major bug-fix updates.
## Installation
```sh
bun add session-rethinkdb-ts
```## Usage
For a list of valid connectOptions, see the [typings][options] for rethinkdb-ts. Additionally, you can pass an already existing store via the 2nd paramater.
```TS
import { RethinkDBStore } from "session-rethinkdb-ts";
import express from "express";
import session from "express-session";const app = express();
// Creates the store
const store = new RethinkDBStore({
// RethinkDB connection options.
connectOptions: {
db: "db",
},
sessionTable: "session", // RethinkDB table to store session info to. Defaults to "session".
sessionTimeout: 86400000, // How long a session ID is valid for. Defaults to 1 day.
flushTimeout: 60000, // How long to wait before flushing data. Defaults to 1 minute.
});// Uses express session with the store
// Valid options: https://github.com/expressjs/session#sessionoptions
app.use(session({
store: store,
saveUninitialized: false,
}));// The rest of your Express server code...
```## License
[MIT][mit]
[mit]: "LICENSE" "Licensed under the MIT License."
[options]: https://github.com/rethinkdb/rethinkdb-ts/blob/de4c51a53f8bc50c2784f302a831938e3e4cfd1a/src/types.ts#L41 "RethinkDB Connect Options"