Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

custom decorator in loopback4

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
  }
}
Comment

PREVIOUS NEXT
Code Example
Typescript :: add column if not exists postgresql 
Typescript :: convert object object to array typescript 
Typescript :: check typescript version 
Typescript :: android studio how to draw a line 
Typescript :: redux toolkit typescript install 
Typescript :: err_too_many_redirects wordpress 
Typescript :: how to sort a list of objects python 
Typescript :: sum of elements in c++ stl 
Typescript :: weakly connected components in graph 
Typescript :: lofi hip hop beats to study to 
Typescript :: Visual Studio Code Typescript region folding 
Typescript :: how to make s3 bucet objects publicj 
Typescript :: Redirects in Odoo Website 
Typescript :: Nmap to find open ports kali linux 
Typescript :: adonis where has 
Typescript :: serenity.is Entity service async to sync requests 
Typescript :: cmd check if folder exists or not 
Typescript :: == restfulapi: Booting VM... There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below. 
Typescript :: how to see constraints in postgresql 
Typescript :: for each typescript 
Typescript :: how to view documents folder simulator swift 
Typescript :: deno router 
Typescript :: The compiler option "strict" should be enabled to reduce type errors. 
Typescript :: typescript add to array 
Typescript :: why is a tree set sorted 
Typescript :: python code find digits 
Typescript :: how to register assets in flutter 
Typescript :: ionic email validation 
Typescript :: typescript array of object findindex 
Typescript :: export class typescript 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =