updated API to use node libraries instead of AJAX