lint
This commit is contained in:
34
main.ts
34
main.ts
@@ -1,42 +1,38 @@
|
|||||||
import { Jetstream } from "@skyware/jetstream";
|
import { Jetstream } from "@skyware/jetstream";
|
||||||
|
|
||||||
const jetstream = new Jetstream({
|
const jetstream = new Jetstream({
|
||||||
wantedCollections: [
|
wantedCollections: ["space.litenote.note"],
|
||||||
"space.litenote.note",
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
jetstream.onCreate("space.litenote.note", (event) => {
|
jetstream.onCreate("space.litenote.note", (event) => {
|
||||||
const { did, commit } = event
|
const { did, commit } = event;
|
||||||
console.log("create", did, commit);
|
console.log("create", did, commit);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
jetstream.onUpdate("space.litenote.note", (event) => {
|
jetstream.onUpdate("space.litenote.note", (event) => {
|
||||||
const { did, commit } = event
|
const { did, commit } = event;
|
||||||
console.log("update", did, commit);
|
console.log("update", did, commit);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
jetstream.on("close", () => {
|
jetstream.on("close", () => {
|
||||||
console.log("Connection closed, PartySocket will reconnect automatically");
|
console.log("Connection closed, PartySocket will reconnect automatically");
|
||||||
});
|
});
|
||||||
|
|
||||||
jetstream.on("error", (error) => {
|
jetstream.on("error", (error) => {
|
||||||
console.log("Connection closed with error", error);
|
console.log("Connection closed with error", error);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("launching jetstream")
|
console.log("launching jetstream");
|
||||||
|
|
||||||
jetstream.start();
|
jetstream.start();
|
||||||
|
|
||||||
// Keep the process alive and provide a health check
|
// Keep the process alive and provide a health check
|
||||||
Bun.serve({
|
Bun.serve({
|
||||||
port: 3000,
|
port: 3000,
|
||||||
routes: {
|
routes: {
|
||||||
"/health": () => new Response("ok"),
|
"/health": () => new Response("ok"),
|
||||||
},
|
},
|
||||||
fetch() {
|
fetch() {
|
||||||
return new Response("Not Found", { status: 404 });
|
return new Response("Not Found", { status: 404 });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user