I am building a web framework which is based on a hierarchical modular design. I’ve got components and components extending other components.
To access these components I’m looking for a nice syntax in the URL. As I’m using Node.js, I’ve got no restrictions whatsoever from existing web server software. Components are simply structured objects in JavaScript that can be piped together.
The URL scheme I use is:
/componentA/componentBextendsA/componentCextendsB
Now, I want to give each component it’s own parameters. Intuitively I wanted to do this with directory-based query-strings, like:
/componentA?foo=bar&hello=world/componentB?foo=test/componentC?pie=
- componentA
foo=barhello=world
- componentB
foo=test
- componentC
pie= empty
The arguments can overlap, as one component can handle the same query parameter as the other.
My questions are:
- can clients break because of this?
- is there an already existing implementation of directory-query-strings?
From the URI component perspective, the URI
/componentA?foo=bar&hello=world/componentB?foo=test/componentC?pie=consists of the path/componentAand the queryfoo=bar&hello=world/componentB?foo=test/componentC?pie=. And inside the query component, both/and?are valid plain characters. So this URI should be handled correctly by clients.If you want to parse this URI the way you’ve described, you can do the following: