Hi all,
I successfully setup and added file through IPFS cluster proxy using postman
But when I dit it within my Golang backend, I got the error Post "http://localhost:9095/api/v0/add": dial tcp 127.0.0.1:9095: connect: connection refused
Here is my code
func Add(c *gin.Context) {
client, err := client.NewDefaultClient(&client.Config{Host: "localhost", Port: "9094"})
if err != nil {
fmt.Println("new client")
fmt.Println(err)
c.JSON(400, gin.H{"data": "Error"})
} else {
file, _, err := c.Request.FormFile("file")
if err != nil {
fmt.Println("multipart")
fmt.Println(err)
c.JSON(400, gin.H{"data": "Error"})
} else {
shell := client.IPFS(c)
CID, err := shell.Add(file)
fmt.Println("add")
fmt.Println(err)
c.JSON(200, gin.H{"cid": CID})
}
}
}
I have tried different host such as 127.0.0.1
, 0.0.0.0
but none worked.
Thanks in advance.