rack-app / rack-app-front_end

Apache License 2.0
0 stars 2 forks source link

request.params is not the same as params #6

Closed dekubu closed 1 year ago

dekubu commented 1 year ago

Given

Screenshot 2023-09-08 at 21 55 42

when I call the script

Screenshot 2023-09-08 at 21 56 12

I get the following logging out put

Screenshot 2023-09-08 at 21 57 23 1

@adamluzsi there is a difference between the params collections. I have observed that the request.params does not include path params or but it does contain params for forms.

can you please confirm If this is by design.

adamluzsi commented 1 year ago

The request object here is a Rack::Request instance.

The Rack::Request object in Ruby's Rack library offers a foundational interface for incoming HTTP requests, primarily wrapping the raw HTTP data in a user-friendly, object-oriented way.

Path parameters in frameworks like rack-app, Sinatra, or Rails represent a more advanced layer, deriving from RESTful API design principles that transform URL path segments into parameters.

While Rack::Request processes raw HTTP data without inferring URL structure or routing, frameworks layered atop Rack introduce path parameters.

In Rack::App, you have access to the following parameter methods in your endpoint:

I recognize that many frameworks adjust the request object, with some crafting their own. However, my goal with rack-app was to stay true to the core Rack experience.

We currently use the original rack/request object without any modifications. I understand your perspective that a rack/app/request object might reduce confusion in a RESTful API design, especially when the path parameter isn't accessed via the params method.

dekubu commented 1 year ago

They say Eveyday is a school day lol! This a fantastic explanation.

I was getting confused because I use a mixture ways to send information through to endpoint and I was having to look in multiple places I appreciate the clarification.

My next part of the Rack-app journey was to understand an implement an extension. I think this this looks like a good candidate to start and learn with.

rack/app/request

I will take a crack at it and post the results here.

Thanks for the speedy reply.

adamluzsi commented 1 year ago

@vidtreonou, my inclination towards minimalism usually keeps things straightforward, but in this instance, it seems to have missed the mark. Just as a joke shouldn't need explaining, neither should an API. I'm genuinely thinking about introducing a Rack::App::Request object to enhance the user experience.

adamluzsi commented 1 year ago

@vidtreonou, could I kindly ask that moving forward, you direct questions about rack-app to the rack-app repository? This space is primarily for front-end topics like template rendering. Sharing your insights there could be invaluable for others navigating past discussions.

We'll keep our current conversation here, and I'll make a note of it when diving into the Rack::App::Request. It's just a thought that discussions centered on rack-app's core functionality might fit better in that repository. I appreciate your flexibility on this!

adamluzsi commented 1 year ago

Would you mind reviewing this kickoff issue in the core project and sharing your thoughts? I'd appreciate any feedback, whether you find the solution acceptable or have a different perspective on the topic.

@vidtreonou, feel free to share your feedback here or directly on the kickoff issue. Either way works for me!

adamluzsi commented 1 year ago

https://github.com/rack-app/rack-app/issues/51

dekubu commented 1 year ago

Would be a pleasure. 

Will let you know 

Delaney Burke Founder

@.*** +372 533 22 524 vidtreon.com http://vidtreon.com

On September 9, 2023, GitHub @.***> wrote:

rack-app/rack-app#51 https://github.com/rack-app/rack-app/issues/51

— Reply to this email directly, view it on GitHub https://github.com/rack-app/rack-app-front_end/issues/6#issuecomment- 1712591328, or unsubscribe https://github.com/notifications/unsubscribe- auth/BBVMTT2WF6SAVYZJ2K32MM3XZTECXANCNFSM6AAAAAA4QZD2VY. You are receiving this because you were mentioned.Message ID: <rack- @.***>