iron router이용시 아래와 같이 json 페이지 생성 가능하다
Router.map(function () {
this.route('pwsite', {
path: '/pw/site',
where: 'server',
action: function() {
var headers = {
'Content-type': 'text/json;charset=UTF-8'
};
var data = Col.find({'master_cd':'pwsite'});
var file = JSON.stringify(data.fetch());
try{
this.response.writeHead(200, headers);
return this.response.end(file);
}catch(e){
this.response.writeHead(500, headers);
}
}
});
});