File tree Expand file tree Collapse file tree 3 files changed +54
-1
lines changed
lib/metric/deprecated-images Expand file tree Collapse file tree 3 files changed +54
-1
lines changed Original file line number Diff line number Diff line change 8585
8686 "node/no-unsupported-features" : " error" ,
8787 "node/process-exit-as-throw" : " error" ,
88- "node/shebang" : " warn " ,
88+ "node/shebang" : " off " ,
8989 "node/no-deprecated-api" : " warn" ,
9090 "no-useless-constructor" : " warn" ,
9191 "no-return-await" : " off"
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+
3+ async function ackDeprecatedImages ( ) {
4+ try {
5+ const count = Number ( process . argv [ 2 ] ) ;
6+ if ( Number . isNaN ( count ) ) {
7+ console . error ( 'Usage: node ./ack-deprecated-images.script.js <count>' ) ;
8+ process . exit ( 1 ) ;
9+ }
10+
11+ const URL = 'http://0.0.0.0:8080/deprecated-images/ack' ;
12+
13+ const response = await fetch ( URL , {
14+ method : 'POST' ,
15+ headers : {
16+ 'Content-Type' : 'application/json'
17+ } ,
18+ body : JSON . stringify ( { count } ) ,
19+ } ) ;
20+
21+ if ( ! response . ok ) {
22+ throw new Error ( `Request failed with status ${ response . status } ` ) ;
23+ }
24+
25+ const data = await response . json ( ) ;
26+ console . log ( JSON . stringify ( data ) ) ;
27+ } catch ( error ) {
28+ console . error ( 'Error: ' , error ) ;
29+ process . exit ( 1 ) ;
30+ }
31+ }
32+
33+ ackDeprecatedImages ( ) ;
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+
3+ async function getDeprecatedImages ( ) {
4+ try {
5+ const URL = 'http://0.0.0.0:8080/deprecated-images' ;
6+
7+ const response = await fetch ( URL ) ;
8+ if ( ! response . ok ) {
9+ throw new Error ( `Request failed with status ${ response . status } ` ) ;
10+ }
11+
12+ const data = await response . json ( ) ;
13+ console . log ( JSON . stringify ( data ) ) ;
14+ } catch ( error ) {
15+ console . error ( 'Error: ' , error ) ;
16+ process . exit ( 1 ) ;
17+ }
18+ }
19+
20+ getDeprecatedImages ( ) ;
You can’t perform that action at this time.
0 commit comments