mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 14:56:07 +08:00
添加Cron接口,更新Dockerfile
This commit is contained in:
parent
7ba3e59980
commit
1d585e2619
21
back/api/cron.ts
Normal file
21
back/api/cron.ts
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import { Router, Request, Response, NextFunction } from 'express';
|
||||||
|
import { Container } from 'typedi';
|
||||||
|
import { Logger } from 'winston';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import config from '../config';
|
||||||
|
const route = Router();
|
||||||
|
|
||||||
|
export default (app: Router) => {
|
||||||
|
app.use('/', route);
|
||||||
|
route.get(
|
||||||
|
'/cron',
|
||||||
|
async (req: Request, res: Response, next: NextFunction) => {
|
||||||
|
const logger: Logger = Container.get('logger');
|
||||||
|
try {
|
||||||
|
} catch (e) {
|
||||||
|
logger.error('🔥 error: %o', e);
|
||||||
|
return next(e);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
};
|
|
@ -3,6 +3,7 @@ import auth from './auth';
|
||||||
import cookie from './cookie';
|
import cookie from './cookie';
|
||||||
import config from './config';
|
import config from './config';
|
||||||
import log from './log';
|
import log from './log';
|
||||||
|
import cron from './cron';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const app = Router();
|
const app = Router();
|
||||||
|
@ -10,5 +11,7 @@ export default () => {
|
||||||
cookie(app);
|
cookie(app);
|
||||||
config(app);
|
config(app);
|
||||||
log(app);
|
log(app);
|
||||||
|
cron(app);
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,7 +25,7 @@ FROM node:lts-alpine
|
||||||
LABEL maintainer="whyour"
|
LABEL maintainer="whyour"
|
||||||
ARG QL_BASE_URL=https://github.com.cnpmjs.org/whyour/qinglong
|
ARG QL_BASE_URL=https://github.com.cnpmjs.org/whyour/qinglong
|
||||||
ARG QL_BASE_BRANCH=master
|
ARG QL_BASE_BRANCH=master
|
||||||
ARG QL_SCRIPTS_URL=https://github.com.cnpmjs.org/RikudouPatrickstar/jd_scripts
|
ARG QL_SCRIPTS_URL=https://gitee.com/highdimen/clone_scripts.git
|
||||||
ARG QL_SCRIPTS_BRANCH=master
|
ARG QL_SCRIPTS_BRANCH=master
|
||||||
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
||||||
LANG=zh_CN.UTF-8 \
|
LANG=zh_CN.UTF-8 \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user