How to connect web3js to mainnet or testnet?

ahmed_chahmed_ch Posts: 3Member
Hello, I want to make a web app which interacts with a contract on testnet/mainnet. I can see in the documentation that the local port to web3js to connect to a local running ethereum instance/simulation:

web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));

But I want to connect it to the testnet or mainnet. Is it possible to do that without actually hosting a real node(test or main) via metamask as a full Ethereum node.

Answers

Sign In or Register to comment.