-
-
Save aaronksaunders/33f0e35007257ca68cfa to your computer and use it in GitHub Desktop.
My First Node.ACS App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* service definition file | |
*/ | |
logger.setLevel('DEBUG'); | |
ACS.init("yourkeys","yourkeys"); | |
// GUESS I NEED THIS TO MAKE IT RUN | |
api.index = function(req, res) { | |
}; | |
// glo | |
ACS.Users.login({ | |
login: 'DONOTDELETE', | |
password: 'admin' | |
}, function(data) { | |
console.log('User logged in!'); | |
console.log(JSON.stringify(data)); | |
if ( data.success === true ) { | |
console.log(data.meta.session_id); | |
loadItUp(data.meta.session_id); | |
} | |
}); | |
/** | |
* loop through JSON file | |
*/ | |
function loadItUp(session_id /* session id needed for calls*/) { | |
var placeJSON = require('/venues'); | |
for (var c in placeJSON) { | |
// create the model and add it to the collection | |
var params = placeJSON[c]; | |
// add session id to api parameters | |
params['session_id'] = session_id; | |
// make the call | |
ACS.Places.create( params , function(data) { | |
if ( data.success === true ) { | |
console.log(JSON.stringify(data)); | |
} else { | |
console.log(JSON.stringify(data.meta)); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment