This repository has been archived by the owner on Aug 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
start a quick intro guide to making ipfs webapps #25
Open
whyrusleeping
wants to merge
1
commit into
master
Choose a base branch
from
webapp-guide
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# WebApps on IPFS | ||
|
||
This is a short guide on how to start making your own web applications on top of | ||
ipfs. | ||
|
||
Ipfs provides an http api to interact with the daemon through, but by | ||
default it has a few security features enabled that make it difficult for people | ||
to use the api in their own apps. There are two different routes you could take | ||
to use the API, first, is to run your own webserver, and make http requests to | ||
localhost:5001. This is in my opinion the easier route for development. For this | ||
to work, you'll need to disable cross origin check by running the daemon with | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cross origin checks |
||
the environment variable `API_ORIGIN` set to `*`: | ||
|
||
``` | ||
$ export API_ORIGIN="*" | ||
$ ipfs daemon | ||
``` | ||
|
||
Now all of the requests you make to the api will work just fine. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
The second route is to publish your app to ipfs (via `ipfs add -r`) and load | ||
it through the http server at `localhost:5001/ipfs/<hash of your app>`. This | ||
does not require you to change the `API_ORIGIN` variable (as you'll be loading | ||
the app from the correct origin) but you will need to tell the daemon that | ||
you want it to allow you to load different apps through the server on the API port. | ||
By default you can only load the ipfs webui through the API port, this is a | ||
security measure to prevent random web pages from making api calls on your daemon. | ||
To disable this for testing your app, run the daemon like: | ||
|
||
``` | ||
$ ipfs daemon --unrestricted-api | ||
``` | ||
|
||
So now that youre able to load your app, you probably want to start making | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. youre >> you're |
||
those api calls I mentioned (you *are* writing an ipfs app, after all). We | ||
recommend everyone use the | ||
[browserified node-ipfs-api](https://github.com/ipfs/node-ipfs-api). | ||
|
||
By | ||
[whyrusleeping](https://github.com/whyrusleeping) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"provides an HTTP API for interacting with the daemon"