From 6eb0c611eea19a8d2eb19ff4854ba1739f81102d Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Thu, 13 May 2021 15:09:58 -0700 Subject: [PATCH] WIP --- package.json | 1 + src/server/route/routes/importComics.routes.ts | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index dab2b5a..e64a5e0 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "react": "^17.0.1", "react-dom": "^17.0.1", "react-hooks-worker": "^1.0.0", + "request": "^2.88.2", "sharp": "^0.28.1", "stream-json": "^1.7.1", "through2": "^4.0.2" diff --git a/src/server/route/routes/importComics.routes.ts b/src/server/route/routes/importComics.routes.ts index d21a6a9..fa8992f 100644 --- a/src/server/route/routes/importComics.routes.ts +++ b/src/server/route/routes/importComics.routes.ts @@ -4,6 +4,7 @@ import axios from "axios"; import stream from "stream"; import through2 from "through2"; import hyperquest from "hyperquest"; +import request from "request"; import es from "event-stream"; import JSONStream from "JSONStream"; import oboe from "oboe"; @@ -12,17 +13,15 @@ router.route("/getComicCovers").post(async (req: Request, res: Response) => { typeof req.body.extractionOptions === "object" ? req.body.extractionOptions : {}; - oboe({ + request({ url: "http://localhost:3000/api/import/getComicCovers", method: "POST", + json: true, body: { extractionOptions: req.body.extractionOptions, walkedFolders: req.body.walkedFolders, }, - }).on("node", ".*", (data) => { - console.log(data); - res.write(JSON.stringify(data)); - }); + }).pipe(res); }); router.route("/walkFolder").post(async (req: Request, res: Response) => {