Gateway to communicate with the Blockless Network.
npm i @blockless/gateway-core
List functions
import Gateway from '@blockless/gateway-core'
const gateway = new Gateway({
mongoUri: process.env.MONGO_DB_URI!,
headNodeUri: process.env.HEAD_NODE_HOST!
})
const functions = await gateway.functions.list()
console.log(functions)
// [{ name: 'Hello World Fn', functionId: 'bafybefgibuxruy...' }]
Invoke a function
import Gateway from '@blockless/gateway-core'
const gateway = new Gateway({
mongoUri: process.env.MONGO_DB_URI!,
headNodeUri: process.env.HEAD_NODE_HOST!
})
const domain = 'hello-world-fn.bls.xyz'
const response = await gateway.functions.invoke('domain', domain)
console.log(response)
// { code: 200, headers: [], type: 'text/html', body: 'Hello World' }
For the latest documentation, visit Blockless Docs
Refer to the CONTRIBUTING.md guide for details.