Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. export function Controller(path: string = "/",options?:ControllerOptions) {
  2. path = path === ""? "/":path
  3. return (constructor: Class<any>) => {
  4. Reflect.defineMetadata(CONTROLLER_PATH, path, constructor);
  5. if(options){
  6. Reflect.defineMetadata(INJECT_OPTIONS,options,constructor);
  7. }
  8.  
  9. let inject = Reflect.getMetadata(Design.Parameters,constructor) || [];
  10.  
  11.  
  12. inject = inject.map((x,index)=>{
  13. return {
  14. index,
  15. identifier:x
  16. }
  17. })
  18.  
  19. Reflect.defineMetadata(PARAMETER,inject,constructor);
  20. return constructor;
  21. };
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement