Nick:
This commit is contained in:
parent
5b8aed26dd
commit
4543c57e4e
@ -1,3 +1,4 @@
|
||||
ENV=
|
||||
NUM_WORKERS_PER_QUEUE=8
|
||||
PORT=
|
||||
HOST=
|
||||
|
@ -1,11 +1,10 @@
|
||||
import { Request, Response } from "express";
|
||||
import { WebScraperDataProvider } from "../../src/scraper/WebScraper";
|
||||
import { billTeam } from "../../src/services/billing/credit_billing";
|
||||
import { checkTeamCredits } from "../../src/services/billing/credit_billing";
|
||||
import { WebScraperDataProvider } from "../scraper/WebScraper";
|
||||
import { billTeam, checkTeamCredits } from "../services/billing/credit_billing";
|
||||
import { authenticateUser } from "./auth";
|
||||
import { RateLimiterMode } from "../../src/types";
|
||||
import { logJob } from "../../src/services/logging/log_job";
|
||||
import { Document } from "../../src/lib/entities";
|
||||
import { RateLimiterMode } from "../types";
|
||||
import { logJob } from "../services/logging/log_job";
|
||||
import { Document } from "../lib/entities";
|
||||
|
||||
export async function scrapeHelper(
|
||||
req: Request,
|
||||
@ -16,7 +15,7 @@ export async function scrapeHelper(
|
||||
success: boolean;
|
||||
error?: string;
|
||||
data?: Document;
|
||||
returnCode?: number;
|
||||
returnCode: number;
|
||||
}> {
|
||||
const url = req.body.url;
|
||||
if (!url) {
|
||||
@ -103,7 +102,7 @@ export async function scrapeController(req: Request, res: Response) {
|
||||
crawlerOptions: crawlerOptions,
|
||||
pageOptions: pageOptions,
|
||||
});
|
||||
return res.json(result);
|
||||
return res.status(result.returnCode).json(result);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return res.status(500).json({ error: error.message });
|
||||
|
@ -3,13 +3,7 @@ import bodyParser from "body-parser";
|
||||
import cors from "cors";
|
||||
import "dotenv/config";
|
||||
import { getWebScraperQueue } from "./services/queue-service";
|
||||
import { addWebScraperJob } from "./services/queue-jobs";
|
||||
import { supabase_service } from "./services/supabase";
|
||||
import { WebScraperDataProvider } from "./scraper/WebScraper";
|
||||
import { billTeam, checkTeamCredits } from "./services/billing/credit_billing";
|
||||
import { getRateLimiter, redisClient } from "./services/rate-limiter";
|
||||
import { parseApi } from "./lib/parseApi";
|
||||
import { RateLimiterMode } from "./types";
|
||||
import { redisClient } from "./services/rate-limiter";
|
||||
import { v0Router } from "./routes/v0";
|
||||
|
||||
const { createBullBoard } = require("@bull-board/api");
|
||||
|
Loading…
Reference in New Issue
Block a user