Смотрите 2 примера под Отправив раздел отклика MeteorChef веб-сайта,
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" });
Таким образом, вы можете отправить ваши данные, используя this.response.end
как это,
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'});
Я никогда не пробовал серверная сторона маршрута сама, поэтому я не уверен, работает ли она или нет.