1
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user