I am using node and express. To register a controller I call:
app.get('/user/:id', function (req, res) {...});
But I would like to do it the rfc-6570 way:
app.get('/user/{id}', function (req, res) {...});
I googled just an implementation in python on google code, but found nothing (except the dead link on google code to http://www.snellspace.com/wp/?p=831) for JavaScript.
URI templating in general is not so easy as it looks on the first sight. Have a look on the examples in the RFC.
PS: I will need the URI templates on the client, too.
I've been cleaning up the implementations list at http://code.google.com/p/uri-templates/wiki/Implementations - there is a JS one at https://github.com/marc-portier/uri-templates but I'm not sure of whether it implements the RFC, nor of what its quality is.
Note that we've started publishing tests here: https://github.com/uri-templates/uritemplate-test
So if you want to check it, you could start there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With