Git Product home page Git Product logo

routing's People

Contributors

dependabot[bot] avatar g105b avatar

Watchers

 avatar  avatar  avatar

Forkers

isabella232

routing's Issues

Dynamic path - get() without parameter

If the $dyanmicPath->get() function is called without a parameter, and there is only one dynamic part to the path, it should return it.

If there is more than one part of the path that's dynamic, and an identifier hasn't been supplied, throw an exception.

Matching */* is not explicit

The */* match is inferred for any non-matches. This means that whatever match comes at the end of the class (in order of the functions' declarations) is always preferred for a user agent that requests */* accept header.

The expected functionality is to match a route only if the */* is present in the available header matches.

Deeper dynamic pages

If the matching view/logic files have a dynamic leaf (deepest filename starts with "@"), requests to deeper directories that don't exist still trigger the leaf logic/view.

This might be expected - how else could a deep directory be built? Maybe this needs to be handled separately by a special file - page/@dynamicDir/_deeper.php for instance?

Logic is now changed...

Ideas

The purpose of this repository is to provide simple routing capability, specifically for the purpose of extracting the hard-coded rules within WebEngine.

When an HTTP request comes in, the following logic is part of WebEngine:

  1. Check the accept header to determine the LogicViewPath (whether the base path is /page, /api or other).
  2. Locate and execute any setup logic for the according URI.
  3. Locate the appropriate View file(s) from the URI. This can be a direct relationship like HTTP GET /about => page/about.html, something dynamic like HTTP GET /shop/kitchen/fridge => page/@category/@item.html or build up from multiple views including _header.html, _footer.html, or anything like that.
  4. Locate any optional Logic file(s) from the URI. This is usually a direct map to the view (page/about.html is backed by page/about.php), but there are a bunch of extra places logic can be shared.
  5. Execute logic files with context of their views.

Assembly: Logic assembly not iterating over all functions - needs investigation

I'm working on a complex project that's causing issues within the Logic Authority.

To recreate, create this page structure:

page
- @outer-id
- - @inner-id
- - - @page-id.html
- - - index.php // redirect to "/outer-123/inner-456/_new"
- - index.php // redirect to "/outer-123/inner-456"
- index.php // redirect to "/outer-123/"

The intention is to redirect the root page through the different layers of automatic ID assignment.

The problem is that the go function of page/@outer-id/index.php doesn't fire. It's there in the assembly, but it isn't iterated by the invoke function. Changing it to go_before does indeed get invoked correctly.

This might not be a bug in the router, but I'm tracking it here.

DynamicPath getFirst() and getLast()

On multiple projects now, an area of the code I'm writing is only interested in the first or last part of the dynamic path. These two functions would be a nice improvement.

Know if an Assembly contains any definite matches

An Assembly represents the source logic/view files that make up the response, but if there are "magic" files in the Assembly (_common, _header, etc.), there's no way of knowing if the Assembly matches any definite file matches.

Common page should match current directory

For consistency, _common.php should be matched by the MagicFileMatch class if the current URI matches the containing folder of the _common.php. Currently, _common's go() will only be executed when the URI is deeper.

Assembly::containsDistinctFile

Currently, whether or not there is a distinct file in the assembly is calculated by checking the first character of the filename - if it's an underscore, then it returns false.

Today, I actually wanted to have a file with an underscore, so this broke my functionality.

Really, it should check to see if it's within the MAGIC_FILENAME_ARRAY list.

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.