File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,30 @@ const storage = new Storage();
10
10
const bucket = storage . bucket ( 'installer-to.appspot.com' ) ;
11
11
12
12
app . get ( '/' , ( req , res ) => {
13
- res . json ( { status : 'OK' } ) ;
13
+ res . set ( 'Content-Type' , 'application/json' ) ;
14
+ res . json ( { status : 'OK' } ) ;
15
+ } ) ;
16
+
17
+ app . get ( '/health' , ( req , res ) => {
18
+ res . set ( 'Content-Type' , 'application/json' ) ;
19
+ res . json ( { status : 'OK' } ) ;
14
20
} ) ;
15
21
16
22
app . get ( '/:package' , ( req , res ) => {
17
23
try {
18
- const file = bucket . file ( req . params . package + '/installer.sh' ) ;
24
+ const minParam = req . query . min ;
25
+ const withParam = req . query . with ;
26
+ const fileName = [ 'installer' ] ;
27
+
28
+ if ( minParam ) {
29
+ fileName . push ( 'min' ) ;
30
+ }
31
+ if ( withParam ) {
32
+ fileName . push ( withParam ) ;
33
+ }
34
+ fileName . push ( 'sh' ) ;
35
+ const fileNameString = fileName . join ( "." ) ;
36
+ const file = bucket . file ( req . params . package + '/' + fileNameString ) ;
19
37
res . set ( 'Content-Type' , 'text/plain' ) ;
20
38
const readStream = file . createReadStream ( ) ;
21
39
readStream . pipe ( res ) ;
You can’t perform that action at this time.
0 commit comments