0

私はダッシュが初めてで、ここにある指示に従い、「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 に答える