开发者

How to say Hello World from a shared node.js server

开发者 https://www.devze.com 2023-04-12 16:14 出处:网络
Hello my fellow ColdFusion developers! I\'m trying to learn node.js, and I have a free sandbox account at http://pusher.com/.

Hello my fellow ColdFusion developers!

I'm trying to learn node.js, and I have a free sandbox account at http://pusher.com/. If I view the API access, they give pastable html code:

<!DOCTYPE html>
<head>
  <title>Pusher Te开发者_如何转开发st</title>
  <script src="http://js.pusherapp.com/1.9/pusher.min.js" type="text/javascript"></script>
  <script type="text/javascript">
    // Enable pusher logging - don't include this in production
    Pusher.log = function(message) {
      if (window.console && window.console.log) window.console.log(message);
    };

    // Flash fallback logging - don't include this in production
    WEB_SOCKET_DEBUG = true;

    var pusher = new Pusher('0xxxx0xxxxxxxxxxxx00');
    var channel = pusher.subscribe('test_channel');
    channel.bind('my_event', function(data) {
      alert(data);
    });
  </script>
</head>

and I have pasted that into a web page.

Then they give some code to send via curl:

curl -d "hello world" \
"http://api.pusherapp.com/apps/7499/channels/test_channel/events?"\
"name=my_event&"\
"body_md5=xxxxxxxxxxxxxxxxx&"\
"auth_version=1.0&"\
"auth_key=0xxxxxxxxxxxxxxx00&"\
"auth_timestamp=1318305150&"\
"auth_signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

but I don't think I have curl.

Q: Can I use cfhttp instead?


I have no idea what is going on here. NodeJS is not your web browser. I do not see how NodeJS relates to any of this.

I never used pusher or coldfusion before, but I am sure you can use ColdFusion to send simple HTTP requests to "pusher", just like curl. HTTP requests are not complicated at all, and curl is a simple command line program that sends and receives them.

The curl command is just opening that long URL as POST request, and sending "hello world" as the body, and "hello world" should appear in your web browser.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号