Controller Design & Build With Prompts For Code Generation
The controller code can be designed based on three basic notions:
- How to name the controller code files?
- How to name the controller methods in that file? And how to link this method to callers, like API or other such service?
- How to build the internal prompt for that method?
For NodeJS/ExpressJS/Sequelize, we found the following controller design pattern which works great.
- File name: The files are generally named after the actor who can access all the methods. This also allows for grouping the security policy for that user. One can also use extra prompts for security specifications.
- Method naming: The methods are named as per the asset and action, like fileUpload. This type of method name can be added in API promptset(separately for file head responsible for API file)
- Internal prompt: The internal code prompt is built using the AAAMP around the user/asset/action with respective model and process to generate the whole function code.
Next: Backend of API
Updated: Oct 11, 2024