SecureAPI is a simple Firebase Cloud Function that relays insecure http APIs into secured https APIs. This comes in handy when some API providers charge you for https APIs. :wink
-
Step 1
- Install Firebase CLI and NodeJS if you havent got them already.
-
Step 2
- Goto Firebase console an create a fresh project. Note down the project ID.
-
Step 3
- Create a new directory
- Execute the command
firebase init
inside the directory.
-
Step 3
- Select Functions from CLI features you want to setup dialog and in the next step choose the project that you noted down earlier when you created a new project. Then select Javascript for the language
-
Step 4
- Install Request Package from command line by executing
npm install --save request
- Install Request Package from command line by executing
-
Step4
- Copy the content of index.js and paste them in your local index.js file
-
Step 5
- Install the dependancies by executing
npm install
- Run the function by executing
firebase emulators:start --only functions
- Install the dependancies by executing
When you're done with testing and want to deploy this into Firebase, do the following.
First you need up upgrade your firebase project into **Blaze plan**. Firebase's always free **Spark Plan** does not support calling 3rd party APIs.
Then you can deploy your function simply by executing
firebase deploy
on your terminal.
If you are not familiar with Firebase functions, You can find a beginners tutorial I wrote here.
Link: https://dev.to/suvink/how-to-create-a-firebase-cloud-function-585g