-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
hi dear team
I found out about your framework in the NodeWeekly email feed.
it is really pleasant to work with it. it is simple but powerful.
and my proposal is:
as for me it is very conveniently to handle endpoints like get /users and get /users/:id at the same controller. so I think it would make sense to add optional param with suburl to controller's methods. something like
class UsersController extends Controller {
@method('GET')
public users(ctx: Context) {
ctx.response.body = users;
}
@method('GET')
public singleUser('/:id', ctx: Context) {
const id = ???;
// for example:
// const splitted = ctx.path.split('/');
// const id = splitted[splitted.length - 1];
// but shortcut will be very usefull
ctx.response.body = users[id];
}
or
@get()
public users(ctx: Context) {
ctx.response.body = users;
}
@get('/:id')
public singleUser(ctx: Context) {
const id = ???;
ctx.response.body = users[id];
}
thank you for your work
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request