import { Controller } from 'egg' ; import { controller , RESTfulController , route } from '../../../../../lib' ; @ controller ( { name : 'Test rest for @controller' , prefix : '/api/rest' , restful : true } ) export class RESTSimpleController extends Controller { index ( ) { return 'index' ; } no ( ) { return 'no' ; } } @ controller ( { name : 'Test rest for @controller' , prefix : '/api/rest2' , restful : true } ) export class RESTFullController extends RESTfulController { @ route ( { url : '/api/rest2/custom' } ) index ( ) { return 'index' ; } new ( ) { return 'new' ; } show ( id ) { return `show_${ id }` ; } edit ( id ) { return `edit_${ id }` ; } @ route ( ) create ( ) { return 'create' ; } update ( id ) { return `update_${ id }` ; } destroy ( id ) { return `destroy_${ id }` ; } no ( ) { return 'no' ; } }