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
Copy file name to clipboardExpand all lines: demos/example-node/README.md
+9-12Lines changed: 9 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,18 +2,15 @@
2
2
3
3
This demonstrates a small NodeJS client opening a database and connecting PowerSync.
4
4
5
-
To get started with this example, you need a configured instance of the PowerSync Service. The easiest way to get started is to configure a PowerSync Cloud instance, docs [here](https://docs.powersync.com/installation/database-connection#create-a-powersync-cloud-instance).
6
-
This example expects the schema of our To-Do list example apps; ensure you deploy compatible Sync Rules to your instance which can be found [in our Supabase integration guide](https://docs.powersync.com/integration-guides/supabase-+-powersync#configure-sync-rules).
5
+
This demo is configured to talk to an example backend [you can host yourself](https://github.com/powersync-ja/self-host-demo). To get started:
7
6
8
-
Being a simple CLI program, this currently doesn't implement authentication. So, you'll need to
9
-
create a [development token](https://docs.powersync.com/installation/authentication-setup/development-tokens#development-tokens) to run this example.
10
-
This demo expects the URL of your PowerSync instance (this can be copied from the PowerSync Dashboard) in the `DEMO_ENDPOINT` environment variable,
11
-
the development token is read from `DEMO_TOKEN`.
7
+
1. Start one of the Node.js backend examples from [the self-host-demo repository](https://github.com/powersync-ja/self-host-demo).
8
+
2. If necessary, change `.env` to point to the started backend and sync service.
9
+
3. Run `pnpm install` and `pnpm build:packages`in the root of this repo.
10
+
4. In this directory, run `pnpm run start`.
12
11
13
-
Once you have these ready:
14
-
15
-
1. Make sure to run `pnpm install` and `pnpm build:packages` in the root of this repo.
16
-
2. Then run the following, inserting your instance URL and developer token:
17
-
```DEMO_ENDPOINT=https://yourinstance.powersync.journeyapps.com DEMO_TOKEN=YOURTOKEN pnpm run start
18
-
```
19
12
This opens the local database, connects to PowerSync, waits for a first sync and then runs a simple query.
13
+
Results from the query are printed every time it changes. Try:
14
+
15
+
1. Updating a row in the backend database and see changes reflected in the running client.
16
+
2. Enter `add('my list')` and see the new list show up in the backend database.
0 commit comments