{"size": 441, "ext": "js", "max_stars_repo_path": "middleware/cacheCorrect.js", "max_stars_repo_name": "jingshenxiaochao/Dart-Cms", "max_stars_repo_stars_event_min_datetime": "2020-03-30T11:18:37.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T07:15:24.000Z", "max_issues_repo_path": "middleware/cacheCorrect.js", "max_issues_repo_name": "JayCriss/Dart-Cms", "max_issues_repo_issues_event_min_datetime": "2020-08-02T07:36:25.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-20T08:06:45.000Z", "max_forks_repo_path": "middleware/cacheCorrect.js", "max_forks_repo_name": "JayCriss/Dart-Cms", "max_forks_repo_forks_event_min_datetime": "2020-04-08T04:13:32.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-26T05:40:56.000Z"}
{"max_stars_count": 481, "max_issues_count": 7, "max_forks_count": 130, "avg_line_length": 18.375, "max_line_length": 47, "alphanum_fraction": 0.5963718821}
const getDB = require('../utils/baseConnect');

module.exports = (ctx, next) => {

	return async (ctx, next) => {

		let confColl = getDB().collection('config');
		let config = await confColl.findOne({});

		let isCacheStatic = config.openStatic;

		let url = ctx.request.url;

		let isCachePath = /^\/cache\//.test(url);

		// 如果不是后台
		if(isCachePath){
			ctx.request.url = url.substring(6);
		}

		await next()
	}

}