elasticsearch-based configurable generic appview for prototyping ideas
at main 831 B view raw
1import { readConfig } from "./config.ts"; 2import { startFirehose } from "./firehose.ts"; 3import { ensureIndexMapping, type IndexerEvent } from "./indexer.ts"; 4import { setupXRPCServer } from "./xrpc.ts"; 5import { processEventForSync } from "./sync.ts"; 6import { parseArgs } from "jsr:@std/cli"; 7 8async function main() { 9 const config = await readConfig("./config.json"); 10 11 const args = parseArgs(Deno.args) 12 13 // prepare indexes 14 await ensureIndexMapping(config); 15 16 setupXRPCServer(config); 17 18 startFirehose({ 19 config, 20 onEvent: (event: IndexerEvent) => { 21 // ESAV Live !!! 22 return processEventForSync(event); 23 }, 24 forcedCursor: args["force-cursor"] 25 }); 26 27 console.log("Server started and listening for events"); 28} 29 30main().catch(err => { 31 console.error("Fatal error in main:", err); 32 Deno.exit(1); 33});