Add-ons
Add-ons are the best way to extend easy-api.ts capabilities by bringing an easy-to-understand API.
Placing the add-on
You must place add-on files some where. Let’s look an example.
- index.js Your API main file
Directorymy_custom_addon
Directoryfunctions
- betterLog.js
- index.js
Directoryroutes
- hello.js
- package.json
Creating your add-on
To create an add-on, you must require the Addon
class in
order to extend it and add custom functionality.
Now, let’s attach the add-on into the API.
Congratulations! You’ve done the basic logic for your first add-on.