This commit is contained in:
张成
2026-03-18 15:25:34 +08:00
parent 5b671d320b
commit 37e39d35b8
17 changed files with 368 additions and 167 deletions

View File

@@ -4,8 +4,7 @@ import body_parser from 'koa-bodyparser';
import { sequelize } from './models/index.js';
import { crawl_router } from './routes/crawl.js';
import { schedule_task_router } from './routes/schedule_task.js';
import { reload_all_schedules } from './services/schedule_loader.js';
import { start_all_cron_tasks } from './services/schedule_loader.js';
dotenv.config();
@@ -13,7 +12,6 @@ const app = new Koa();
app.use(body_parser({ jsonLimit: '10mb' }));
app.use(crawl_router.routes()).use(crawl_router.allowedMethods());
app.use(schedule_task_router.routes()).use(schedule_task_router.allowedMethods());
app.use(async (ctx) => {
ctx.status = 404;
@@ -24,7 +22,7 @@ const port = Number(process.env.SERVER_PORT || 38080);
await sequelize.authenticate();
await sequelize.sync();
await reload_all_schedules();
start_all_cron_tasks();
app.listen(port);
// eslint-disable-next-line no-console