Skip to content

Latest commit

 

History

History

core

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

@blockless/gateway-core

CI

Gateway to communicate with the Blockless Network.

Install

npm i @blockless/gateway-core

Basic Usage

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' }

Documentation

For the latest documentation, visit Blockless Docs

Contributing

Refer to the CONTRIBUTING.md guide for details.