Friday 19 May 2017

Node.JS expose external library to exports functions

I need to access an external library in an api file that I am creating. I am getting a 'request is not defined' error. Is there something I need to do in order to expose the library to the exports functions?

var request = require('request-promise');

module.exports = {
  getEntries: function() {
    return request.get('jsonplaceholder.typicode.com/posts/1');
  }
};



via Molly Harper

No comments:

Post a Comment