123456789101112131415161718 |
- 'use strict';
- const _ = require('lodash');
- const getController = (url) => {
- if (!_.isString(url)) return;
- const arr = _.trimStart(url, '/').split('/');
- return _.head(arr);
- };
- module.exports = (options) => {
- return async function logdb(ctx, next) {
- let url = _.clone(ctx.request.url);
- url = url.replace(ctx.app.config.routePrefix, '');
- const c = getController(url);
- console.log(ctx.service[c].toExport.operation);
- console.log(ctx.routerName);
- console.log(ctx.routerPath);
- await next();
- };
- };
|