Skip to content

initial impressions/feature requests #20

@muturgan

Description

@muturgan

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

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions