- Introduced a new crawling management feature allowing users to configure, execute, and log web crawls. - Added CRUD operations for crawl configurations, including URL analysis and preview capabilities. - Implemented a new service for handling crawling logic and scheduling tasks. - Integrated cheerio for HTML parsing and axios for HTTP requests. - Created a sample HTML page for testing crawling functionality. This commit enhances the application's data collection capabilities from external websites.
33 lines
994 B
TypeScript
33 lines
994 B
TypeScript
import { Router } from "express";
|
|
import { authenticateToken } from "../middleware/authMiddleware";
|
|
import {
|
|
getCrawlConfigs,
|
|
getCrawlConfig,
|
|
createCrawlConfig,
|
|
updateCrawlConfig,
|
|
deleteCrawlConfig,
|
|
previewCrawl,
|
|
analyzeUrl,
|
|
executeCrawl,
|
|
getCrawlLogs,
|
|
} from "../controllers/crawlController";
|
|
|
|
const router = Router();
|
|
|
|
// 설정 CRUD
|
|
router.get("/configs", authenticateToken, getCrawlConfigs);
|
|
router.get("/configs/:id", authenticateToken, getCrawlConfig);
|
|
router.post("/configs", authenticateToken, createCrawlConfig);
|
|
router.put("/configs/:id", authenticateToken, updateCrawlConfig);
|
|
router.delete("/configs/:id", authenticateToken, deleteCrawlConfig);
|
|
|
|
// 분석 & 미리보기 & 실행
|
|
router.post("/analyze", authenticateToken, analyzeUrl);
|
|
router.post("/preview", authenticateToken, previewCrawl);
|
|
router.post("/execute/:id", authenticateToken, executeCrawl);
|
|
|
|
// 실행 로그
|
|
router.get("/configs/:id/logs", authenticateToken, getCrawlLogs);
|
|
|
|
export default router;
|