aqua icon indicating copy to clipboard operation
aqua copied to clipboard

Group feature

Open predetermined opened this issue 3 years ago • 4 comments

I think a group feature would be cool. It should maybe have some of the following features.

  • Prefix
  • Middleware

Maybe something like:

app.group((context) => {
    context.get(...);
    ....
});

predetermined avatar Mar 21 '21 15:03 predetermined

I really don't think if this is the style of code intended for this project, but I love decorators like they are used in Spring

Why not trying to create this as a side project :

@Controller("hello")
export default class students {
  @get("/")
  public static getStudent(req) {
     return "hello world";
  }
  @get("/:name")
  public static getStudent(req) {
     return `hello, ${req.parameters.name} !`;
  }
}

LoganTann avatar Jul 05 '22 07:07 LoganTann

This looks very NestJS-ish, maybe it might go against the idea of being a minimal framework?

felixfong227 avatar Jul 05 '22 08:07 felixfong227

This looks very NestJS-ish, maybe it might go against the idea of being a minimal framework?

Exactly, that's why I talked about the idea of create such structure as a personal project instead of directly implementing this in aqua 😊

LoganTann avatar Jul 05 '22 09:07 LoganTann

having decorators would definitely make the code much more readable from my personal opinion

felixfong227 avatar Jul 06 '22 12:07 felixfong227