@@ -27,7 +27,9 @@ <h4>Routes</h4>
27
27
Here are the resources that JSON Server has loaded:
28
28
</ p >
29
29
< ul id ="resources "> loading, please wait...</ ul >
30
-
30
+
31
+ < div id ="custom-routes "> </ div >
32
+
31
33
< p >
32
34
You can view database current state at any time:
33
35
</ p >
@@ -36,10 +38,10 @@ <h4>Routes</h4>
36
38
< a href ="db "> db</ a >
37
39
</ li >
38
40
</ ul >
39
-
41
+
40
42
< p >
41
43
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.
43
45
</ p >
44
46
45
47
< h4 > Documentation</ h4 >
@@ -61,17 +63,30 @@ <h4>Issues</h4>
61
63
</ p >
62
64
</ div >
63
65
64
-
65
66
< script
66
67
src ="https://code.jquery.com/jquery-3.0.0.min.js "
67
68
integrity ="sha256-JmvOoLtYsmqlsWxa7mDSLMwa6dZ9rrIdtrrVYRnDRH0= " crossorigin ="anonymous "> </ script >
68
69
< script >
69
70
$ ( function ( ) {
70
71
$ . 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' )
72
88
$ . each ( data , function ( key , value ) {
73
- $ ( '#resources' )
74
- . append ( '<li><a href="' + key + '">' + key + '</a></li>' ) ;
89
+ listEl . append ( '<li>' + key + ' → ' + value + '</li>' )
75
90
} )
76
91
} )
77
92
} )
0 commit comments