README: move Node.js section down

This commit is contained in:
Alex Gleason 2023-04-18 19:23:35 -04:00
parent d1e726b612
commit 7b188170eb
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

View File

@ -100,14 +100,6 @@ You can also import from a tag:
Therefore, to upgrade to a newer version of strfry-policies, you can simply change the import URL. Therefore, to upgrade to a newer version of strfry-policies, you can simply change the import URL.
## Usage with Node.js
We highly recommend running this library with Deno, but for those looking to incorporate it into an existing Node.js project, an NPM version is provided:
- https://www.npmjs.com/package/strfry-policies
This version is built with [dnt](https://github.com/denoland/dnt) which provides Node.js shims for Deno features. Some policies that rely on sqlite may not work, but core fuctionality and TypeScript types work fine, so it can be used as a framework to build other policies.
## Writing your own policies ## Writing your own policies
You can write a policy in TypeScript and host it anywhere. Deno allows importing modules by URL, making it easy to share policies. You can write a policy in TypeScript and host it anywhere. Deno allows importing modules by URL, making it easy to share policies.
@ -218,6 +210,14 @@ Then, in the pipeline:
- You should not use `console.log` anywhere in your policies, as strfry expects stdout to be the strfry output message. - You should not use `console.log` anywhere in your policies, as strfry expects stdout to be the strfry output message.
## Usage with Node.js
We highly recommend running this library with Deno, but for those looking to incorporate it into an existing Node.js project, an NPM version is provided:
- https://www.npmjs.com/package/strfry-policies
This version is built with [dnt](https://github.com/denoland/dnt) which provides Node.js shims for Deno features. Some policies that rely on sqlite may not work, but core fuctionality and TypeScript types work fine, so it can be used as a framework to build other policies.
## Filtering jsonl events with your policy ## Filtering jsonl events with your policy
It is not currently possible to retroactively filter events on your strfry relay. You can however export the events with `strfry export`, filter them locally, and then import them into a fresh database. You can also use this command to filter Nostr events from any source, not just strfry. It is not currently possible to retroactively filter events on your strfry relay. You can however export the events with `strfry export`, filter them locally, and then import them into a fresh database. You can also use this command to filter Nostr events from any source, not just strfry.