Skip to content

remove-bg/remove-bg-serverless-azure

Repository files navigation

Serverless remove.bg API using Microsoft Azure Functions

What is it?

If you call the remove.bg API you have to provide your API key for authentication. If you are worried about exposing this API key you can set up your own relay function on Microsoft Azure that injects the API key on the server and forwards all other parameters to the remove.bg API and then returns the result.

  • It enhances the security of your front end
  • Especially for mobile apps
  • Use it as a boilerplate to do all kinds of things that our API can't do

Supported Cloud Function Providers

Provider URL
Google Cloud Functions https://github.com/remove-bg/remove-bg-serverless-gcf
Microsoft Azure Functions https://github.com/remove-bg/remove-bg-serverless-azure

Setup your remove.bg relay on Microsoft Azure Functions

For general reference check out the official docs: https://docs.microsoft.com/en-us/azure/developer/javascript/how-to/develop-serverless-apps

  1. Create a new function with Runtime stack Node.js, 14 LTS, choose your desired region
  2. Click Deploy
  3. In your function Configuration open Settings > Configuration
  4. Add a Runtime environment variable called REMOVE_BG_API_KEY and set it to your remove.bg API key

Deploy with Visual Studio Code

  1. Install the Azure Functions plugin and log in within Visual Studio Code (https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions)
  2. Navigate to your functions in the Azure Tab in VSCode
  3. Open Application Settings and add a new Setting called REMOVE_BG_API_KEY using your remove.bg API key as value
  4. Click on the Deploy to Function App...
  5. Select your function in the popup

Calling the cloud function

  1. Note the URL logged in the deploy output after HTTP Trigger Urls:
  2. Replace remove.bg API endpoint with this URL
  3. Remove your API key from the header of your call

Local debugging

For general reference check out the official docs: https://docs.microsoft.com/en-us/azure/developer/javascript/tutorial/vscode-function-app-http-trigger/tutorial-vscode-serverless-node-test-local

  1. Your API key is configured in the Application Settings in the Azure Functions
  2. Launch locally with VSCode Launch config Launch Azure Function locally

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published