API Design & Code Generation
Design of api structure is an age old problem in IT architecture circles. There are a great many frameworks and apps dedicated for API only. It is mainly because of the key reason that technology development process, aka software development, is broken into parts. Or to say it in summary, it is broken.
FASTBUILDER Is Like Instant Iron Casting & Molding
When you build the whole software in one go, the software build process completes in one go within a few minutes. It is comparable to casting from molten iron or 3D printing. These processes are instant, continuous and objective oriented, holistic.
The promptset design pattern for API involves finding the following four pattern pivots:
- Which methods have to be connected to the API service?
- What type of security principle needs to be applied?
- How to implement that security principle in the prompt framework?
- How to bring all the APIs to one location, as close as possible? For better management
We are following the app structure for API design in NodeJS/ExpressJS application stack.
The design pattern is as follows:
- Set the API Path: /config/rest_routes/publicRouer.js for Actor filter of “user” only. As user is assumed to be a guest user.
- Set the Gen Path: [Actor]
- Set the phase: [Actor,Asset,Action]
- Set the initcode of bare shell API file(shown below)
- Set the prompt as below
———————API Prompt——————————
Add following API call in the publicRouter with name of controller and method listed below. Controller: @ActorController Method: @Asset@Action Call Type: POST EndPoint: @Actor-@Asset-Action
———————————————————————
—————API Bareshell—————
const publicRouer = { //'POST /user-file-Upload:’UserController.file’Upload, }; module.exports = publicRouer;
———————————————————
Next: The security principles
Updated: Oct 11, 2024