Skip to content

Latest commit

 

History

History
 
 

browser-browserify

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Bundle ipfs-provider, js-ipfs-http-client and js-ipfs with Browserify!

In this example, you will find a boilerplate you can use to guide yourself into bundling everything with browserify, so that you can use it in your own web app for a robust IPFS fallback.

Run this example

Make sure ipfs-provider is built first, as this demo uses local version of ipfs-provider at file:../../

$ npm install # all dependencies
$ npm start

Now open your browser at http://localhost:8888

Fallback explanation

After loading http://localhost:8888 you should see something similar to the following:

Let's unpack what happened in the above example:

  1. 🔴 there was no window.ipfs (no ipfs-companion, or disabled by user)
  2. 🔴 test request to local API (/ip4/127.0.0.1/tcp/5001) was blocked due to CORS protection
  3. 🔴 /api/v0/ on the same Origin as the page did not exist
  4. 🔴 explicitly defined remote API was offline (http://dev.local:8080)
  5. 💚 final fallback worked: spawning embedded js-ipfs was executed successfully 🚀✨