-
Notifications
You must be signed in to change notification settings - Fork 96
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
Discussion: a better routing schema #76
Comments
@Jackymancs4 here are my thoughts:
The change to include the resultant size in |
I notice that on your homepage you say "we'd love to feature more artists' series." I feel that the :scope should be included as a way of future-proofing, so you can add more sets later (for example, say I created a set that I called 'monkey faces.' This could easily be added, then, by using the scope |
@brandonmack111 I agree! So perhaps we need four top-level resources, then:
|
You might also want to allow custom avatars in other sets, perhaps with I'm considering working on this one myself, since I actually want to put together a set for you, and this would need to be sorted out first. |
@brandonmack111 I think that there's a compromise between what is possible and what we can support as maintainers. Generating custom (not generated from an I see one valid use case for the custom avatars: it allows clients the ability to override the hashing mechanism implemented by the middleware. If we instead make that piece of the codebase more modular and extensible, I would prefer that route to some arbitrary number of hardcoded endpoints. |
@brandonmack111 something like this: var Avatars = require('adorable-avatars');
var avatarsMiddleware = Avatars({ hashFunction: myHashingFunction });
var myApp = express();
myApp.use('/myAvatars', avatarsMiddleware) |
Good point about maintainability - though I do think it can be done simply
enough, it is obviously better to keep it as simple as possible.
I do like the idea of a custom hash function, as that makes it really
simple for more advanced users to add a ton of custom functionality,
without adding tons of endpoints.
|
Or just API versioning |
cc @rylnd
This was the last issue I had in mind to do, I promise!
Right now the endpoint set look like this:
and as a developer I found it a bit confusing and hard coded.
So after some experiment I would propose you to implement the whole thing in a different way that (assuming #74 will land) should follow this schema:
I tried this new routing system on my local setup and it feels pretty good, being way more predictable and scalable. Also it doesn't add almost any logic on top of what exists now.
If you are wondering about
\avatars\meta\:size\list
I was thinking about lettinglist
return an object likeThis add the ability to programmatically get the default size (or any size), that is another thing I find pretty useful.
Any thoughts?
The text was updated successfully, but these errors were encountered: