In this example, you will find a boilerplate you can use to guide yourself into bundling js-ipfs-api with webpack, so that you can use it in your own web app!
As for any js-ipfs-api example, you need a running IPFS daemon, you learn how to do that here:
Note: If you load your app from a different domain than the one the daemon is running (most probably), you will need to set up CORS, see https://github.com/ipfs/js-ipfs-api#cors to learn how to do that.
A quick (and dirty way to get it done) is:
> ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"*\"]"
> ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials "[\"true\"]"
Once the daemon is on, run the following commands within this folder:
> npm install
> npm start
Now open your browser at http://localhost:3000
You should see the following: