|
|
@ -37,12 +37,12 @@ app.get( '/:package', function( req, res, next ){ |
|
|
|
return fileExists( cacheFile ) |
|
|
|
.tap( function( isExists ){ |
|
|
|
if( !isExists ){ |
|
|
|
if ( ENABLE_NPM_FAILOVER ) { |
|
|
|
res._log.cacheHit = '---'; |
|
|
|
return fetchAndCacheMetadata( packageName, cacheFile ); |
|
|
|
} else { |
|
|
|
return res.status( 404 ).json( {} ); |
|
|
|
} |
|
|
|
if ( ENABLE_NPM_FAILOVER ) { |
|
|
|
res._log.cacheHit = '---'; |
|
|
|
return fetchAndCacheMetadata( packageName, cacheFile ); |
|
|
|
} else { |
|
|
|
return res.status( 404 ).json( {} ); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
.then( function( ){ |
|
|
@ -65,12 +65,12 @@ app.get( '/:package/-/:tarball', function( req, res, next ){ |
|
|
|
fileExists( packagePath ) |
|
|
|
.tap( function( isExists ){ |
|
|
|
if( !isExists ){ |
|
|
|
if ( ENABLE_NPM_FAILOVER ) { |
|
|
|
res._log.cacheHit = '---'; |
|
|
|
return fetchAndCacheTarball( packageName, version, packagePath ); |
|
|
|
} else { |
|
|
|
return res.status( 404 ).json( {} ); |
|
|
|
} |
|
|
|
if ( ENABLE_NPM_FAILOVER ) { |
|
|
|
res._log.cacheHit = '---'; |
|
|
|
return fetchAndCacheTarball( packageName, version, packagePath ); |
|
|
|
} else { |
|
|
|
return res.status( 404 ).json( {} ); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
.then( function(){ |
|
|
|