bunch of functionlity
This commit is contained in:
62
web/server/confighub.js
Normal file
62
web/server/confighub.js
Normal file
@@ -0,0 +1,62 @@
|
||||
Machines = new Mongo.Collection("machines");
|
||||
|
||||
Meteor.startup(function() {
|
||||
// code to run on server at startup
|
||||
|
||||
// Global API configuration
|
||||
Restivus.configure({
|
||||
prettyJson: true,
|
||||
useAuth: false
|
||||
});
|
||||
|
||||
Restivus.addCollection(Machines);
|
||||
Restivus.addRoute('post/:_id', {
|
||||
get: function () {
|
||||
var id = this.urlParams._id; // "5"
|
||||
return {hamo:1}
|
||||
}
|
||||
});
|
||||
Restivus.addRoute('/api/templates/:type', {
|
||||
|
||||
},{
|
||||
get: {
|
||||
action: function() {
|
||||
var type = this.urlParams.type;
|
||||
var fs = Meteor.npmRequire('fs');
|
||||
|
||||
var template = Async.runSync(function(done) {
|
||||
// github.gists.getFromUser({user: 'arunoda'}, function(err, data) {
|
||||
// done(null, data);
|
||||
// });
|
||||
fs.readFile('../public/configs/'+type+'.conf', function(err, data) {
|
||||
done(null, data);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
return template.result;
|
||||
}
|
||||
}
|
||||
})
|
||||
// Restivus.addRoute('/api/machines', {
|
||||
// // authRequired: false
|
||||
// }, {
|
||||
// get: {
|
||||
// action: function() {
|
||||
// var allMaMachines = Machines.find({});
|
||||
// return {
|
||||
// meho:1,
|
||||
// data: allMaMachines
|
||||
// };
|
||||
// }
|
||||
// // var post = Posts.findOne(this.urlParams.id);
|
||||
// // if (post) {
|
||||
// // return {status: 'success', data: post};
|
||||
// // }
|
||||
// // return {
|
||||
// // statusCode: 404,
|
||||
// // body: {status: 'fail', message: 'Post not found'}
|
||||
// // };
|
||||
// }
|
||||
// });
|
||||
});
|
||||
Reference in New Issue
Block a user