This guide provides a complete walkthrough for setting up and running a Go-based microservice that interacts with the Züs decentralized storage network.
Alternatively, you can store the wallet JSON file in any location of your choice. To retrieve your wallet information, you can use the recover wallet command from zwalletcli.
Or you can use any location to create the json file. You can retrieve your wallet info by using recover wallet from the zwalletcli.
package main
import (
"log"
"net/http"
"go_zus_blog/handlers" // Replace with your module name if different
"github.com/gorilla/mux"
)
func main() {
router := mux.NewRouter()
router.HandleFunc("/init-sdk", handlers.InitSDKHandler).Methods("POST")
router.HandleFunc("/upload-file", handlers.UploadFileHandler).Methods("POST")
router.HandleFunc("/download-file", handlers.DownloadFileHandler).Methods("POST")
log.Println("Go microservice running on port 8080")
log.Fatal(http.ListenAndServe(":8080", router))
}
curl -X POST http://localhost:8080/download-file \
-H "Content-Type: application/json" \
-d '{
"allocation_id": "allocation-id",
"filename": "filename of file you would like to download from allocation",
"auth_ticket": "auth-ticket-string",
"local_path": "/path/to/local/download"
}'