import {inject, intercept, Interceptor} from '@loopback/context';
import {get, HttpErrors, RestBindings} from '@loopback/rest';
const myInterceptor: Interceptor = async (invocationCtx, next) => {
// your code
// goes here
// if success
next()
// if error
throw new HttpErrors.NotFound();
};
export class PingController {
constructor() {}
@intercept(myInterceptor)
@post('/test')
async test(@requestBody() body: any) {
// some code
}
}