import Controller , { Controller$ , Router$ } from "../class/controller" ; import { ROUTER } from "../const" ; param method param path function request ( method , path ) { return function ( target , propertyKey , descriptor ) { if ( target instanceof Controller === false || typeof target [ propertyKey ] !== "function" ) { throw new Error ( `@${ method } decorator is only for class method` ) ; } const routers = target [ ROUTER ] || [ ] ; routers . push ( { path : path , method : method . toLocaleLowerCase ( ) , handler : propertyKey } ) ; target [ ROUTER ] = routers ; } ; } export function Get ( path ) { return request ( "GET" , path ) ; } export function Post ( path ) { return request ( "POST" , path ) ; } export function Put ( path ) { return request ( "PUT" , path ) ; } export function Delete ( path ) { return request ( "DELETE" , path ) ; } export function Head ( path ) { return request ( "HEAD" , path ) ; } export function Patch ( path ) { return request ( "PATCH" , path ) ; } export function Options ( path ) { return request ( "OPTIONS" , path ) ; } export function All ( path ) { return request ( "ALL" , path ) ; }