@@ -8,7 +8,7 @@ var refreshPairs;
88var codes ;
99var url ;
1010var access ;
11- /*202: Accepted - everything is ok.
11+ /*200: Ok - everything is ok.
1212/*308: Permanent Redirect - this url will always redirect to this path.
1313/*400: Bad request - incorrect request syntax.
1414/*401: Unauthorized - missing identification.
@@ -67,7 +67,7 @@ async function apiNew(res, u, p, l, rb, pair) {
6767 await refreshPairs ( ) ;
6868 var msg = "Short url has been registered." ;
6969 var response = { message : msg , label : l , shortUrl : `${ url } ${ p } ` , orgUrl : u , registeredBy : rb } ;
70- return res . json ( { status : codes . acc , response : response } ) ;
70+ return res . json ( { status : codes . ok , response : response } ) ;
7171 }
7272 return res . json ( { status : codes . badReq , response : `Page \`${ url } ${ p } \` is already taken.` } ) ;
7373}
@@ -88,7 +88,7 @@ async function apiEditPage(res, p, np, rb, pair) {
8888 var msg = "Short url has been updated." ;
8989 //prettier-ignore
9090 var response = { message : msg , label : pair . label , shortUrl : `${ url } ${ np } ` , orgUrl : pair . url , registeredBy : pair . registeredBy , clicks : pair . clicks || 0 } ;
91- return res . json ( { status : codes . acc , response : response } ) ;
91+ return res . json ( { status : codes . ok , response : response } ) ;
9292}
9393//[Update url]
9494async function apiEditUrl ( res , p , nu , rb , pair ) {
@@ -104,7 +104,7 @@ async function apiEditUrl(res, p, nu, rb, pair) {
104104 var msg = "Short url has been updated." ;
105105 //prettier-ignore
106106 var response = { message : msg , label : pair . label , shortUrl : `${ url } ${ p } ` , orgUrl : nu , registeredBy : pair . registeredBy , clicks : pair . clicks || 0 } ;
107- return res . json ( { status : codes . acc , response : response } ) ;
107+ return res . json ( { status : codes . ok , response : response } ) ;
108108}
109109//[Change label]
110110async function apiEditLabel ( res , p , nl , rb , pair ) {
@@ -120,7 +120,7 @@ async function apiEditLabel(res, p, nl, rb, pair) {
120120 var msg = "Short url has been updated." ;
121121 //prettier-ignore
122122 var response = { message : msg , label : nl , shortUrl : `${ url } ${ p } ` , orgUrl : pair . url , registeredBy : pair . registeredBy , clicks : pair . clicks || 0 } ;
123- return res . json ( { status : codes . acc , response : response } ) ;
123+ return res . json ( { status : codes . ok , response : response } ) ;
124124}
125125//[Search in urls]
126126async function apiSearch ( res , u , p , l , rb ) {
@@ -149,7 +149,7 @@ async function apiSearch(res, u, p, l, rb) {
149149 if ( a . clicks > b . clicks ) return 1 ;
150150 return 0 ;
151151 } ) ;
152- return res . json ( { status : codes . acc , response : response } ) ;
152+ return res . json ( { status : codes . ok , response : response } ) ;
153153}
154154//[Delete a url]
155155async function apiDelete ( res , p , l , rb , pair ) {
@@ -166,7 +166,7 @@ async function apiDelete(res, p, l, rb, pair) {
166166 await pair . delete ( ) ;
167167 //[Refresh Database]
168168 await refreshPairs ( ) ;
169- return res . json ( { status : codes . acc , response : response } ) ;
169+ return res . json ( { status : codes . ok , response : response } ) ;
170170}
171171//[Refresh database]
172172async function apiRefresh ( res , rb ) {
@@ -191,7 +191,7 @@ async function apiRefresh(res, rb) {
191191 var response = {
192192 message : [ `Databse refreshed succesefully.` , `${ aAmount } added.` , `${ rAmount } removed.` , `${ cAmount } changed.` ] ,
193193 } ;
194- return res . json ( { status : codes . acc , response : response } ) ;
194+ return res . json ( { status : codes . ok , response : response } ) ;
195195}
196196//aid func
197197function prep ( p , r , c , u , a ) {
0 commit comments