我是语言初学者。我已经下载了这个项目(https://github.com/goadesign/goa-cellar)并在本地环境中运行它。当我使用 goa-cellar 客户端进行发布、获取、列表调用时,它运行良好。
步骤:-
- 去获取 github.com:goadesign/goa-cellar.git
- goagen bootstrap -d
- goa-cellar/design go build
服务器:-
- 启动服务器 ->/.goa-cellar
以下是对我使用 goa-cellar 客户端的示例请求:
客户:-
- 创建账户 -> ./cellar-cli create account/cellar/accounts --payload '{"name": "test"}'
- 列出账户 -> ./cellar-cli 列出账户
- 显示账户 -> ./cellar-cli 显示账户/cellar/accounts/1
我想使用 curl 或通过 Postman(chrome 插件)或浏览器插件发出上述请求。我该怎么做?
我尝试了以下方法:-
<强>1。创建帐户
方法:POST
请求正文: {"name": "test"}
请求 header :- Content-Type:application/json
回应:-
{
"code": "not_found",
"status": 404,
"detail": "/"
}
服务器日志:-
INFO[06-23|19:08:25] started req_id=RQLpC8kzbF-2 POST=/ from=127.0.0.1 ctrl=<unknown> action=<unknown>
INFO[06-23|19:08:25] payload req_id=RQLpC8kzbF-2 raw=null
INFO[06-23|19:08:25] completed req_id=RQLpC8kzbF-2 status=404 error=not_found bytes=47 time=97.542µs
最佳答案
只需将数据发送到正确的 HTTP API 端点,在您的情况下,而不是此 /
,需要使用 cellar/accounts
( http://localhost:8082/cellar/accounts )
通过 POST
保存数据,通过 GET
+ id
- 检索数据。
看README有关使用此项目的详细信息。
关于google-chrome - 如何为 goa-cellar 项目创建 curl 请求或在 Postman(插件)中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37993173/