添加Cron接口,更新Dockerfile

This commit is contained in:
whyour
2021-03-27 21:18:44 +08:00
parent 7ba3e59980
commit 1d585e2619
3 changed files with 25 additions and 1 deletions
+21
View 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
View File
@@ -3,6 +3,7 @@ import auth from './auth';
import cookie from './cookie';
import config from './config';
import log from './log';
import cron from './cron';
export default () => {
const app = Router();
@@ -10,5 +11,7 @@ export default () => {
cookie(app);
config(app);
log(app);
cron(app);
return app;
};