Link Search Menu Expand Document

Get Started

  • This feature is available for domains on Bip Plus

Getting started with Bip Functions is easy.

First, create a new folder outside of your main project. This is where your function code will reside.

Create a file in that folder called index.js, containing the following:

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request))
})

async function handleRequest(request) {
  return new Response('Hello world!')
}

Next, run:

bip fn create

You’ll be asked for the domain you want the function to reside on, and for the name of your new function. For this example, call your function helloworld.

Initialise your function directory with:

bip fn init

When prompted, enter the domain and function name that you chose. You only need to do this once.

Finally, deploy your function using:

bip fn deploy

Once your function has been deployed, go to https://yourdomain.bip.sh/_functions/helloworld and you’ll see ‘Hello world!’ displayed!


© 2021 Bip.sh, Ltd.