I’m following documentation here and I want to write a middleware in loopback to log all requests.
I write this Middleware provider:
@injectable(
asMiddleware({
group: 'log',
upstreamGroups: ['sendResponse'],
chain: RestTags.REST_MIDDLEWARE_CHAIN,
}),
)
export class LogMiddlewareProvider
implements Provider<Middleware> {
value(): Middleware {
return async (ctx, next) => {
const {request} = ctx
try {
console.log(request.method);
const result = await next();
return result;
} catch (err) {
console.log(err);
throw err;
}
}
}
}
But I can not find in documentation that how I can use this provider and how can I inject this into sequence or in my application