Skip to content

Commit

Permalink
docs: add docs info
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Jan 18, 2024
1 parent 4e55a46 commit 3424f1e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ This example shows how you can start your own gateway, assuming you have an `IPF
implementation.

```go
// Initialize your headers and apply the default headers.
headers := map[string][]string{}
gateway.AddAccessControlHeaders(headers)

conf := gateway.Config{
Headers: headers,
}
conf := gateway.Config{}

// Initialize an IPFSBackend interface for both an online and offline versions.
// The offline version should not make any network request for missing content.
Expand All @@ -29,9 +23,11 @@ ipfsBackend := ...
// Create http mux and setup path gateway handler.
mux := http.NewServeMux()
handler := gateway.NewHandler(conf, ipfsBackend)
handler = gateway.NewHeaders(nil).ApplyCors().Wrap(handler)
mux.Handle("/ipfs/", handler)
mux.Handle("/ipns/", handler)


// Start the server on :8080 and voilá! You have a basic IPFS gateway running
// in http://localhost:8080.
_ = http.ListenAndServe(":8080", mux)
Expand Down

0 comments on commit 3424f1e

Please sign in to comment.