Bootstrapping Your Application
The Beapi API Framework has several built-in tools to help you get started that will automate most of the development/build for you. Below is an explaination of those tools and how to use them.
The 'Generate API Controllers' Command
Once you have your projects domains built, you can then 'autogenerate' your controllers using the following command from the root of the project:
./gradlew GenerateController
This will generate a BASIC set of controllers for all your domain classes. There is no need to add annotations or anything to them as this is all handled by the BeAPI framework. These controllers are all set and ready to go and provide an example structure for you to use and work from.
NOTE: If you are not using the 'profile', you will need to add the following code to the bottom of your 'build.gradle' file:
task generateControllerCommand(type: ApplicationContextCommandTask) {
classpath = project.sourceSets.main.runtimeClasspath + project.configurations.console
command = "generate-controller"
}
generateControllerCommand {
systemProperties = System.properties
}
The 'Generate IO State' Command
After you have built your domains AND controllers, you can then 'autogenerate your IO State files using the following command from the root of your project:
./gradlew GenerateIostate
This will then create all the necessary state files for your endpoints used by the framework.
NOTE: If you are not using the 'profile', you will need to add this code to the bottom of your 'build.gradle' file:
task generateIostateCommand(type: ApplicationContextCommandTask) {
classpath = project.sourceSets.main.runtimeClasspath + project.configurations.console
command = "generate-iostate"
}
generateIostateCommand {
systemProperties = System.properties
}
Troubleshooting
- For best results, The 'GenerateControllers' command should always be run BEFORE the 'GenerateIOState' command.
- If you are bootstrapping your controllers, make sure all your corresponding domains exist first.