我从数据库中获取数据,它们显示在浏览器或邮递员之类的软件中,与此相同/ 20221125143847// http://localhost:3000/api/v1/datesmain/read{"alldates": [{ "ID": 1, "CreatedAt": "2022-11-25T00:00:00Z", "UpdatedAt": "2022-11-25T00:00:00Z", "DeletedAt": null, "volume": "20", "image_url": "/assets/images/IMG_3429.jpg\n", "average_weight": 7.5, "dates_type_id": 1, "wight_type_id": 1},{ "ID": 2, "CreatedAt": "2022-11-25T00:00:00Z", "UpdatedAt": "2022-11-25T00:00:00Z", "DeletedAt": null, "volume": "15", "image_url": "/assets/images/IMG_3436.jpg\n", "average_weight": 7.5, "dates_type_id": 1, "wight_type_id": 1} ]}正如您看到的图像 url 是正确的,并且所有图像都在项目根目录中的文件夹中,名称为“assets”,因为我不理解它可能通过此 URL 显示我的图像http://localhost:3000/api/v1/datesmain/assets/images/IMG_3429.jpg我想用java或...将它们全部显示为前端的列表视图但是当像这样在浏览器中复制并过去一个 url 时// http://localhost:3000/api/v1/datesmain/static/images/IMG_3429.jpg { "message": "Not Found" }我该如何解决?这是我的小代码func ReadAllDatesMain(e echo.Context) error {ad, err := logic.ReadAllDatesMain()if err != nil { return nil}return e.JSON(http.StatusOK, map[string]interface{}{ "alldates": ad,})}
- 1 回答
- 0 关注
- 68 浏览
添加回答
举报
0/150
提交
取消