Router.route("/api/test", function() {
this.response.writeHead(200, {
'Access-Control-Allow-Origin': '*'
});
this.response.statusCode = 200;
//this.response.data = {test: 'test'};
this.response.end({ test: 'test' });
}, {where: 'server'});
ben hiç denemedim,
Router.route("users/:name/profile", function() { var name = this.params.name, query = this.request.query, fields = {}; fields[ query.field ] = query.field; var getUser = Meteor.users.findOne({ "profile.username": name }, { fields: fields }); if (getUser) { this.response.statusCode = 200; this.response.end(getUser.profile); } else { this.response.statusCode = 404; this.response.end({ status: "404", message: "User not found." }); } }, { where: "server" });
Yani böyle this.response.end
kullanarak veri gönderebilir, MeteorChef Web sitesinin bir yanıt Gönderme bölümüne altı 2 örneklere bakın sunucu tarafı kendime yollar, Bu yüzden çalışıp çalışmadığından emin değilim.