Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Start gateway from NodeJS #1187

Closed
paulogr opened this issue Jan 24, 2018 · 4 comments
Closed

Start gateway from NodeJS #1187

paulogr opened this issue Jan 24, 2018 · 4 comments
Labels
kind/support A question or request for support

Comments

@paulogr
Copy link
Contributor

paulogr commented Jan 24, 2018

I've been looking at code but haven't found a way to start the gateway from NodeJS.

new IPFS() only starts the IPFS node but not the gateway.

Thanks

@victorb
Copy link
Member

victorb commented Jan 24, 2018

Something like this should work (it also starts a js-ipfs node for using with the gateway):

const Gateway = require('ipfs/src/http')

const gateway = new Gateway('./path-to-ipfs-repo')
gateway.start(true, () => {
  console.log('Gateway now running')
})

The function for starting the gateway is here:

function HttpApi (repo, config, cliArgs) {

@paulogr
Copy link
Contributor Author

paulogr commented Jan 24, 2018

Thank you for awswer.

I saw this class HttpApi, but isn't exposed to be consumed, right?
Is there any reason?

@daviddias
Copy link
Member

@paulogr you can use https://github.com/ipfs/js-ipfsd-ctl to spawn js-ipfs daemons which then expose the gateway. Would that work for you?

@daviddias daviddias added status/ready Ready to be worked kind/support A question or request for support labels Jan 25, 2018
@paulogr
Copy link
Contributor Author

paulogr commented Jan 26, 2018

Proprably it works for me, yeah.
I'll make some tests, closing for now.

Thank you for answer.

@paulogr paulogr closed this as completed Jan 26, 2018
@ghost ghost removed the status/ready Ready to be worked label Jan 26, 2018
MicrowaveDev pushed a commit to galtproject/js-ipfs that referenced this issue May 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/support A question or request for support
Projects
None yet
Development

No branches or pull requests

3 participants