import { myService } from '@example/my-service'
import { createHelia } from 'helia'
import { libp2pDefaults } from '@helia/libp2p'
// get a copy of the default libp2p config
const libp2p = libp2pDefaults()
// add the custom service to the service map
libp2p.services.myService = myService()
// create a Helia node with the custom libp2p config
const helia = await createHelia({
libp2p
})
//... use service
helia.libp2p.services.myService.serviceMethod()
Returns the default libp2p config used by Helia which can then be modified or extended to suit individual applications.
import { myService } from '@example/my-service'
import { createHelia } from 'helia'
import { libp2pDefaults } from '@helia/libp2p'
// get a copy of the default libp2p config
const libp2p = libp2pDefaults()
// add the custom service to the service map
libp2p.services.myService = myService()
// create a Helia node with the custom libp2p config
const helia = await createHelia({
libp2p
})
//... use service
helia.libp2p.services.myService.serviceMethod()
Returns the default libp2p config used by Helia which can then be modified or extended to suit individual applications.