NODJS で簡単な Web サーバーを作成しました。Web ブラウザ、つまり firfox に接続すると、hello world が表示されhttp://localhost:8888/
ます。しかし、enyon Web サービスの onSuccess コールバックは、inResponse からの null 文字列を表示します。静的な Web ページを作成し、enyo がローカルの hypache サーバーから正常にロードしました。nodejsから送信されたものからenyoが常にw nullを表示しないのはなぜですか??
ウェブサーバー
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8888);
ボタンを押すとWebサービスを実行し、アラートボックスに結果を表示する簡単なenyoプログラムを作成しました
enyo.kind({
name: "MyApps.MainApp",
kind: enyo.VFlexBox,
// comment code to load in data gfrom service
components: [
{name: "getName", kind: "WebService",
onSuccess: "gotName",
onFailure: "gotNameFailure",
url: "http://localhost:8888/"
},
{kind: "PageHeader", content: "Enyo FeedReader"},
{name:"curValue", content:("Sample Text")},
{kind: "Button", caption: "Action", onclick: "btnClick"} ],
// functions go here
create: function()
{
// call the default creat then do our stuff
this.inherited(arguments);
this.$.getName.call();
},
// Show output of server,
gotName: function(inSender, inResponse) {
this.$.button.setCaption("Success");
alert(inResponse );
},
// go here if it cold not connect to server
gotNameFailure: function(inSender, inResponse) {
this.$.button.setCaption("Failure"); },
// call the server
btnClick: function() {
this.$.getName.call(); }
});
テッド