From f3872f35b5067922deffec80881e4c17dc25ae35 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Sun, 19 Dec 2021 15:06:03 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B1=20JSON=20streaming=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/comicvine.service.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/comicvine.service.ts b/services/comicvine.service.ts index 6570626..8c1ac4b 100644 --- a/services/comicvine.service.ts +++ b/services/comicvine.service.ts @@ -2,7 +2,13 @@ import { Service, ServiceBroker, Context } from "moleculer"; import axios, { AxiosResponse } from "axios"; +import hyperquest from "hyperquest"; +import JSONStream from "JSONStream"; +import es from "event-stream"; + import { matchScorer } from "../utils/searchmatchscorer.utils"; + + const CV_BASE_URL = "https://comicvine.gamespot.com/api/"; console.log("KEYYYYYYYY", process.env.COMICVINE_API_KEY); export default class ComicVineService extends Service { @@ -65,7 +71,7 @@ export default class ComicVineService extends Service { offset, resources, }, - transformResponse: (r) => { + transformResponse: r => { const matches = JSON.parse(r); return matchScorer( matches.results,