Skip to content

Commit

Permalink
add Deno KV driver instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs224 committed Sep 16, 2023
1 parent 102270f commit fbd9b4a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,29 @@ app.get('/', async (c, next) => {
Deno.serve(app.fetch)
```

#### Using Deno KV storage driver

```ts
import { Hono } from 'https://deno.land/x/[email protected]/mod.ts'
import { sessionMiddleware } from 'https://deno.land/x/hono_sessions/mod.ts'
import { DenoKvStore } from 'https://deno.land/x/hono_sessions/src/store/deno/DenoKvStore.ts'

const app = new Hono()

const kv = await Deno.openKv()
const store = new DenoKvStore(kv)

app.use('*', sessionMiddleware({
store,
// ... other session options
}))

// Other app code

Deno.serve(app.fetch)

```

### Bun

```ts
Expand All @@ -90,6 +113,8 @@ export default {

#### Using Bun's SQLite storage driver

This will automatically create a `database.sqlite` file and a `sessions` table in that sqlite database.

```ts
import { Hono } from 'hono'
import { sessionMiddleware } from 'hono-sessions'
Expand Down

0 comments on commit fbd9b4a

Please sign in to comment.