Skip to content

Commit

Permalink
docs: how to use and create examples
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Oct 16, 2023
1 parent 611b790 commit 8660c62
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
# Boxo Examples and Tutorials

In this folder, you can find some examples to help you get started using Boxo and its associated libraries in your applications.
In this directory, you can find some examples to help you get started using Boxo and its associated libraries in your applications.

Let us know if you find any issue or if you want to contribute and add a new tutorial, feel welcome to submit a PR, thank you!

## How To Use the Examples

The examples are designed to give users a starting point to create certain things using Boxo. However, this directory is not meant to be directly copied out of Boxo, since it uses a replacement directive in the [`go.mod`](go.mod) file. You can also not `go install`.

If you want to copy of the examples out of Boxo in order to use it in your own product, you need to remove the replacement directive and ensure you're using the latest Boxo version:

```bash
> go mod edit -dropreplace=github.com/ipfs/boxo
> go get github.com/ipfs/boxo@latest
> go mod tidy
```

## How To Create an Example

All examples are self-contained inside the same module ([`examples`](go.mod)). To create an example, clone Boxo, navigate to this directory and create a sub-directory with a descriptive name for the example. If the example pertains a topic that has multiple examples, such as `gateway`, create a sub-directory there.

The new example must contain a descriptive `README.md` file, which explains what the example is, how to build and use it. See the existing examples to have an idea of how extensive it should be. In addition, your code must be properly documented.

Once you have your example finished, do not forget to run `go mod tidy` and adding a link to the example in the section [Examples and Tutorials](#examples-and-tutorials) below.

## Examples and Tutorials

- [Fetching a UnixFS file by CID](./unixfs-file-cid)
Expand Down

0 comments on commit 8660c62

Please sign in to comment.