@@ -27,7 +27,9 @@ <h4>Routes</h4>
2727 Here are the resources that JSON Server has loaded:
2828 </ p >
2929 < ul id ="resources "> loading, please wait...</ ul >
30-
30+
31+ < div id ="custom-routes "> </ div >
32+
3133 < p >
3234 You can view database current state at any time:
3335 </ p >
@@ -36,10 +38,10 @@ <h4>Routes</h4>
3638 < a href ="db "> db</ a >
3739 </ li >
3840 </ ul >
39-
41+
4042 < p >
4143 You can use any HTTP verbs (GET, POST, PUT, PATCH and DELETE) and access your resources from anywhere
42- using CORS and JSONP.
44+ using CORS or JSONP.
4345 </ p >
4446
4547 < h4 > Documentation</ h4 >
@@ -61,17 +63,30 @@ <h4>Issues</h4>
6163 </ p >
6264 </ div >
6365
64-
6566 < script
6667 src ="https://code.jquery.com/jquery-3.0.0.min.js "
6768 integrity ="sha256-JmvOoLtYsmqlsWxa7mDSLMwa6dZ9rrIdtrrVYRnDRH0= " crossorigin ="anonymous "> </ script >
6869 < script >
6970 $ ( function ( ) {
7071 $ . get ( 'db' ) . then ( function ( data ) {
71- $ ( '#resources' ) . empty ( ) ;
72+ var el = $ ( '#resources' )
73+
74+ el . empty ( )
75+
76+ $ . each ( data , function ( key , value ) {
77+ el . append ( '<li><a href="' + key + '">' + key + '</a></li>' )
78+ } )
79+ } )
80+
81+ $ . get ( '__rules' ) . then ( function ( data ) {
82+ var el = $ ( '#custom-routes' )
83+
84+ el . append ( '<p>And the custom routes:</p>' )
85+ . append ( '<ul id="custom-routes-list">' )
86+
87+ var listEl = $ ( '#custom-routes-list' )
7288 $ . each ( data , function ( key , value ) {
73- $ ( '#resources' )
74- . append ( '<li><a href="' + key + '">' + key + '</a></li>' ) ;
89+ listEl . append ( '<li>' + key + ' → ' + value + '</li>' )
7590 } )
7691 } )
7792 } )
0 commit comments