Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URI templates: Is there an rfc-6570 implementation in javascript?

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.

like image 881
afx Avatar asked May 05 '12 17:05

afx


1 Answers

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.

like image 175
Mark Nottingham Avatar answered Sep 23 '22 13:09

Mark Nottingham