Git Product home page Git Product logo

Comments (5)

Dashron avatar Dashron commented on July 26, 2024

"/\d+/posts/" might be a bad example here. Is there a way to provide extra data down into a route? Or maybe we need a way to have routes redirect within the router.

Basically, should it be "/\d+/posts/" or should the user module depend on the blog_posts_resource, which uses the posts uri, and has a "///" route.

from roads.

Dashron avatar Dashron commented on July 26, 2024

maybe this isn't best.

Look into building a way to generate child resources? or mixed resources.
so the user resource would depend on a "PostUser" resource, which is an extension of the post resource with brand new routes, each of which expect some form of user information to be provided to the route.

from roads.

Dashron avatar Dashron commented on July 26, 2024

Added research tag. This should be decided on after some common use cases have been developed (a more advanced example resource, and some sub_example resources)

from roads.

Dashron avatar Dashron commented on July 26, 2024

13bed9e

This uses the technique of stripping out the resource uri on each request.
This is nice because it allows me to move the entire site up into a subdirectory just by changing the example resources uri.

Maybe the right technique is a combination.
Use the uri strip technique, but still provide a way to depend on a core resource, with a separate routing mechanism.

eg.

example depends on user and blog_post
user depends on blog_post(blog_user_routes)

/user/5/posts
becomes user/5/posts after the example uri is removed
becomes 5/posts after the user uri is removed
?becomes 5 after the /posts uri is removed?
?user 5 is loaded, and then we route again into /posts, providing user 5 as a parameter?

The last one seems like the best technique, but I'm not sure how intuitive that would end up. This all seems way too complicated. For the moment maybe we keep this uri stripping thing in as a test, and just assume people use one level of hierarchy. it will be more like the traditional controller scheme that people are used to.

from roads.

Dashron avatar Dashron commented on July 26, 2024

Currently, the example uses an empty uri, and then the first level sub routes have /user/, /posts/ etc. This is useful for routing from within a resource.

from roads.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.