3.0.6 • Published 17 days ago

@shopify/shopify-app-session-storage-kv v3.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
17 days ago

Session Storage Adapter for CloudFlare KV

CloudFlare's KV storage can be used on worker runtimes. Before using it, you'll need to set up a namespace for your sessions and pass in a KVNamespace object. You can do that either when creating an instance of KVSessionStorage, or by calling the setNamespace method.

import {shopifyApp} from '@shopify/shopify-app-express';
import {KVSessionStorage} from '@shopify/shopify-app-session-storage-kv';

const shopify = shopifyApp({
  sessionStorage: new KVSessionStorage(),
  // ...
});

export default {
  async fetch(
    request: Request,
    env: Env,
    ctx: ExecutionContext,
  ): Promise<Response> {
    shopify.config.sessionStorage.setNamespace(env.MY_KV_NAMESPACE);
    // Handle request
  },
};

// OR

import {Miniflare} from 'miniflare';
const mf = new Miniflare({
  kvNamespaces: ['MY_KV_NAMESPACE'],
});
const shopify = shopifyApp({
  sessionStorage: new KVSessionStorage(
    await mf.getKVNamespace('MY_KV_NAMESPACE'),
  ),
  // ...
});

If you prefer to use your own implementation of a session storage mechanism that uses the SessionStorage interface, see the implementing session storage guide.

3.0.6

17 days ago

3.0.5

25 days ago

3.0.4

1 month ago

3.0.3

2 months ago

3.0.2

3 months ago

3.0.1

3 months ago

3.0.0

3 months ago

2.0.4

4 months ago

2.0.3

4 months ago

2.0.2

5 months ago

1.0.9

10 months ago

1.0.11

9 months ago

1.0.10

10 months ago

1.0.14

8 months ago

2.0.1

7 months ago

1.0.13

8 months ago

2.0.0

7 months ago

1.0.12

9 months ago

1.0.8

11 months ago

1.0.7

12 months ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago