Add functions and search page
This commit is contained in:
21
functions/src/index.ts
Normal file
21
functions/src/index.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import * as functions from 'firebase-functions';
|
||||
import * as request from 'request';
|
||||
|
||||
// // Start writing Firebase Functions
|
||||
// // https://firebase.google.com/docs/functions/typescript
|
||||
//
|
||||
// export const helloWorld = functions.https.onRequest((request, response) => {
|
||||
// response.send("Hello from Firebase!");
|
||||
// });
|
||||
|
||||
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( 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 );
|
||||
// } );
|
||||
} );
|
Reference in New Issue
Block a user