0

我是 dashing 的新手,按照此处的说明进行操作,并成功启动并运行了“sweet_dashboard_project”。

在仪表板的底部,它说:

"Try this: curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text": "Hey, Look what I can do!" }' \http://localhost:3030/widgets/welcome"

当我尝试它时,会出现以下错误:

    curl: (6) Could not resolve host: auth_token
    curl: (6) Could not resolve host: YOUR_AUTH_TOKEN,
    curl: (6) Could not resolve host: text
    curl: (6) Could not resolve host: Hey, Look what I can do!
    curl: (3) [globbing] unmatched close brace/bracket in column 1
    curl: (1) Protocol \http not supported or disabled in libcurl

config.ru 看起来像这样

require 'dashing'

configure do
  set :auth_token, 'YOUR_AUTH_TOKEN'

  helpers do
    def protected!
     # Put any authentication code you want in here.
     # This method is run before accessing any resource.
    end
  end
end

map Sinatra::Application.assets_prefix do
  run Sinatra::Application.sprockets
end

run Sinatra::Application

在此处输入图像描述

我在这里做错了什么?

谢谢!

4

2 回答 2

2

您使用\http的是不正确的。

另外,在 json 周围加上双引号(如果你使用 windows)。使用标题application/json

curl -d "{ \"auth_token\": \"YOUR_AUTH_TOKEN\", \"text\": \"Hey, Look what I can do!\" }' -H "Content-Type: application/json" http://localhost:3030/widgets/welcome
于 2014-02-08T14:16:14.200 回答
1

假设您使用的是 Windows,这将起作用?

curl -X POST  -H "Content-Type: application/json" -d "{ \"auth_token\": \"YOUR_AUTH_TOKEN\", \"text\": \"Hey, Look what I can do!\" }" http://localhost:3030/widgets/welcome
于 2014-04-03T15:05:32.663 回答