Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] - Resource and Any route #80

Closed
javad-zobeidi opened this issue Jun 15, 2024 · 0 comments
Closed

[Feature Request] - Resource and Any route #80

javad-zobeidi opened this issue Jun 15, 2024 · 0 comments
Assignees
Labels
feature request Proposals for new features
Milestone

Comments

@javad-zobeidi
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
The current Router class lacks built-in support for defining routes that can handle any HTTP method any and for creating standard RESTful resource routes resource This makes it cumbersome to manage routes efficiently, requiring repetitive code and manual setup for each HTTP method and resource route.

Describe the solution you'd like
I would like the Router class to include the following methods:

  1. Router.any: A method to define routes that respond to any HTTP method, allowing for flexible and DRY (Don't Repeat Yourself) route definitions.
  2. Router.resource: A method to create standard RESTful resource routes (index, create, store, show, edit, update, destroy) with built-in support for parameter validation.

Describe alternatives you've considered
Manually Defining Routes: Manually defining each route for resource controllers and any method handlers, which leads to repetitive code and a higher risk of errors.

Additional context

// Example of using any method to handle any HTTP method
Router.any('req/any', (Request request) {
  return Response.json(request.all());
});

// Example of defining resource routes with validation
Router.resource('posts', PostController())
    .prefix('admin')
    .middleware([AuthMiddleware()]);
@javad-zobeidi javad-zobeidi added the feature request Proposals for new features label Jun 15, 2024
@javad-zobeidi javad-zobeidi self-assigned this Jun 15, 2024
@javad-zobeidi javad-zobeidi added this to the 0.3.0 milestone Jun 15, 2024
javad-zobeidi added a commit to javad-zobeidi/framework that referenced this issue Jun 15, 2024
Add Resource and Any route (vania-dart#80)
Refactor Router,Route Handler
@javad-zobeidi javad-zobeidi closed this as completed by moving to Completed in Development Roadmap Jun 15, 2024
@javad-zobeidi javad-zobeidi mentioned this issue Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Proposals for new features
Projects
Status: Completed
Development

No branches or pull requests

1 participant