typestack/routing-controllers

feature: <how make sub folder controllers> how make sub folder controllers

khanhnam99 opened this issue · 2 comments

how make sub folder controllers

What do you mean by sub folder controllers? Do you mean how to span controller methods across the same route paths?

import { Get, JsonController } from 'routing-controllers';

@JsonController('/images')
export class IndexController {
    @Get('/')
    async index() {
        return 'this is the images root';
    }
}

@JsonController('/images/products')
export class Index2Controller {
    @Get('/')
    async index() {
        return 'this is the images/products root';
    }
}

The above should match /images/ to IndexController and /images/products to Index2Controller.

If the above is not what you mean could you elaborate and provide an example ?

@khanhnam99 please close this if your issue is resolved