7

I'm creating a Node app.

I have JavaScript files that include custom functions that make calls to external APIs (in this case Google APIs)

I have JavaScript files in my node app that are related to setting up the web app and using these custom functions described above

What would be a good name for these JavaScript files that make external API calls? Should I call it a wrapper or a service? (How would I visualize the separate responsibility layers of this project?) I'm trying to pick a proper name that is intuitive for other new comers to the project understand what files are responsible for what.

2

In my opinion, you have 2 levels of components here.

  • External API Client
  • Internal Service

In few lines (excuse me in advance for being so simplistic), we can summarise the client as the set of components meant to implement the communication to the remote (external) service. There's no business logic here. These components are agnostic to your purposes (like a driver). For instance, these components fall into the same category than DAOs, in consequence, I would not call them services.

Wrapping one or more clients there are the services. In an ideal scenario, components at this layer are not as tightly coupled to the external service model as the client is. These components might not be so agnostic to your purposes because they are meant to cover a real need of your system. So they perform operations that suit system requirements in the way the system need it.

What do you think is your case? If you fall into the middle of both definitions, it means (maybe) that you didn't separate concerns.

Just a note. Google call to its API SDK: Google APIs Client Libraries

It might interest also Google APIs Client Libraries for Node

0

From an architectural point of view it makes totally sense to speak of these "modules" as the foundation of what is called a service-layer whose job it is to serve you with necessary data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.