'Defining API class in component based structure

I have been reading the 'Node JS Best Practices' Github article. One point that I I found interesting was the very first best practice. Here they split up the project structure based on components. One of the advises was to use functions and classes outside the component by defining them in an API class. But I can't find any examples on how such class should be build.

This is the link to the Github article: Component bases project structure



Solution 1:[1]

You Just Connect Your Main Index file . every script File Then AutoLoad Practices.

Var myVar2 = require('./your_file') 

Solution 2:[2]

You can have a look at this, if you wanna structure your project in different parts and make that more readable.

Im attaching one of the boilerplate link of github since, it will be huge to tell you everything here, just look at this setup you will know everything.

check this link for boilerplate.

If you have doubts let me know.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ryihan
Solution 2