Now that we have a clear understanding of web3 in an isolated environment, it's time to get out of our comfort zone and see how it interacts with Truffle. We've already seen a bit of this in Chapter 1, Truffle for Decentralized Applications.
Let's refer back to our app.js file under chapter1/app/javascripts/ (https://github.com/PacktPublishing/Truffle-Quick-Start-Guide/blob/master/chapter1/app/javascripts/app.js).
Let's see how we import web3:
import { default as Web3} from 'web3';
Now, let's see how we set the blockchain network provider for web3:
window.web3 = new Web3(new Web3.providers.HttpProvider("http://127.0.0.1:9545"));
Remember how we simply glossed over this in Chapter 1, Truffle for Decentralized Applications? Hopefully, you now have a better understanding of what's going on here. Since we don&apos...