You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A set of Examples on how to call the OpenFGA JS SDK
4
+
5
+
### Examples
6
+
Example 1:
7
+
A bare-bones example. It creates a store, and runs a set of calls against it including creating a model, writing tuples and checking for access.
8
+
9
+
### Running the Examples
10
+
11
+
Prerequisites:
12
+
-`docker`
13
+
-`make`
14
+
-`Node.js` 16.13.0+
15
+
16
+
#### Run using a published SDK
17
+
18
+
Steps
19
+
1. Clone/Copy the example folder
20
+
2. If you have an OpenFGA server running, you can use it, otherwise run `make run-openfga` to spin up an instance (you'll need to switch to a different terminal after - don't forget to close it when done)
21
+
3. Run `make setup` to install dependencies
22
+
4. Run `make run` to run the example
23
+
24
+
#### Run using a local unpublished SDK build
25
+
26
+
Steps
27
+
1. Build the SDK
28
+
2. In the Example `package.json` change the `@openfga/sdk` dependency from a semver range like below
29
+
```json
30
+
"dependencies": {
31
+
"@openfga/sdk": "^0.3.1"
32
+
}
33
+
```
34
+
to a `file:` reference like below
35
+
```json
36
+
"dependencies": {
37
+
"@openfga/sdk": "file:../../"
38
+
}
39
+
```
40
+
3. If you have an OpenFGA server running, you can use it, otherwise run `make run-openfga` to spin up an instance (you'll need to switch to a different terminal after - don't forget to close it when done)
0 commit comments