Send default data on production mode

This commit is contained in:
Mathieu Sanchez 2019-06-12 22:24:25 +09:00
parent d8199e30b6
commit 9347c36883

View File

@ -1,5 +1,4 @@
import * as functions from 'firebase-functions'; import * as functions from 'firebase-functions';
import * as request from 'request';
// // Start writing Firebase Functions // // Start writing Firebase Functions
// // https://firebase.google.com/docs/functions/typescript // // https://firebase.google.com/docs/functions/typescript
@ -10,12 +9,8 @@ import * as request from 'request';
export const search = functions.https.onRequest( ( req, res ) => { export const search = functions.https.onRequest( ( req, res ) => {
request( 'http://142.4.212.26:8080/search?s=' + req.params[0], ( error, response, body ) => { res.send( '[{"tfidf":"0.0052","url":"https://www.skysports.com/share/11740401"},{"tfidf":"0.0023","url":"https://www.skysports.com/share/11740370"},{"tfidf":"0.0021","url":"https://www.skysports.com/share/11740366"},{"tfidf":"0","url":"https://www.skysports.com/share/11740338"},{"tfidf":"0.0012","url":"https://www.skysports.com/share/11740227"},{"tfidf":"0.0038","url":"https://www.skysports.com/share/11740400"},{"tfidf":"0","url":"https://www.skysports.com/share/11728937"},{"tfidf":"0","url":"https://www.skysports.com/share/11731660"},{"tfidf":"0.0007","url":"https://www.skysports.com/share/11739856"},{"tfidf":"0.0035","url":"https://www.skysports.com/share/11740171"},{"tfidf":"0.0007","url":"https://www.skysports.com/share/11740333"},{"tfidf":"0.0009","url":"https://www.skysports.com/share/11709253"},{"tfidf":"0","url":"https://www.skysports.com/share/11709512"},{"tfidf":"0","url":"https://www.skysports.com/share/11713244"},{"tfidf":"0","url":"https://www.skysports.com/share/11740141"}]' );
res.send( body ); // request( 'http://142.4.212.26:8080/search?s=' + req.params[0], ( error, response, body ) => {
} ); // res.send( body );
// request.get( 'http://142.4.212.26:8080/search?s=' + req.query.s ).on( "error", ( data ) => {
// res.send( data );
// } ).on( "response", ( data ) => {
// res.send( data );
// } ); // } );
} ); } );