Need to use Node.js in order to make given API call?

Viewed 44

I am building a web app to help students practice writing essays. So far the app is all client-side: it uses just HTML, CSS, and vanilla JS. I was just about to start configuring the API calls for a grammar checker API. I had planned on using the Fetch API for these calls, but the grammar checker API that interests me uses pre-built SDKs: https://prowritingaid.com/en/App/API.

They provide the JS installation instructions here: https://github.com/prowriting/prowritingaid.javascript#installation.

Here is the sample API call:

var ProWritingAidApi = require('pro_writing_aid_api');

var api = new ProWritingAidApi.TextApi();
api.apiClient.basePath="https://api.prowritingaid.com";
api.apiClient.defaultHeaders={'licenseCode': 'your license code'}
var request = new ProWritingAidApi.TextAnalysisRequest(
  "I couldnt wait any any longer, I new what I hadd to do",
  ['grammar'],
  "General",
  "En"
);
api.post(request)
  .then(function(data) {
    console.log('API called successfully. Returned data: ');
    console.log(data);
  }, function(error) {
    console.error(error);
  });

So it seems that I need to use Node.js in order to use this API, correct? Since the entire app was going to be client-side, do I need to install Node.js and set up a server just so that I'll be to make the above API call?

0 Answers
Related