In this example, you will find a boilerplate you can use to guide yourself into bundling everything with esbuild (similar to browserify), so that you can use it in your own web app for a robust IPFS fallback.
Make sure ipfs-provider
is built first, as this demo uses local version of ipfs-provider
at file:../../
$ npm ci
$ npm start
Now open your browser at http://localhost:8888
After loading http://localhost:8888
you should see something similar to the following:
Let's unpack what happened in the above example:
- 🔴 test request to local API (
/ip4/127.0.0.1/tcp/5001
) was blocked due to CORS protection - 🔴
/api/v0/
on the same Origin as the page did not exist - 🔴 explicitly defined remote API was offline (
http://dev.local:8080
) - 💚 final fallback worked: spawning embedded js-ipfs was executed successfully 🚀✨