Uses uritemplate-js and jQuery
This library combines uritemplate-js with jQuery to process RFC 6570 URI Templates before the form is submitted.
In other words, when this library is loaded, given this form:
<form action="/api/users/{username}" method="GET"> <label> username <input name="username" type="text" value="example"> </label> <input type="submit"> </form>
The action will be updated to /api/users/example
when the
form is submitted.
To build, install the requirejs optimizer node package:
npm install requirejs
Then:
r.js -o build.js
When To Use It
If you have an api that uses templated routes, this can help you write forms that test the routes.
Why You Should Not Use ItIt breaks the web. URI Templates are not part of any html standard. User agents that do not enable javascript will not work. It does not degrade gracefully.
Caveat emptor.
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。