Wazei Framework is a versatile web framework designed for the swift creation of REST APIs, particularly useful for testing and generating stubs. You can develop REST APIs rapidly without coupling your code to this framework. This decoupling ensures seamless integration for those who aim to use a real framework in the future. Your source code is remains fully portable with this no-code integration solution.
This repository provides the necessary code to facilitate the accelerated creation of REST APIs, enabling you to work independently of your source code. This is advantageous for scenarios where you may not have finalized the choice of library for your application or when you need to quickly generate a REST API for testing or stubbed data.
- Library Agnosticism: When you're uncertain about the library you'll use for your application, Wazei allows you to write controllers, and by leveraging code documentation, you can effortlessly create your endpoints.
- Rapid API Prototyping: When you want to swiftly create a REST API for testing purposes or to generate stubbed data.
-
Create a Package for Controllers: Start by creating a package to house your controllers.
-
Define a Controller Class: Create a controller class with your desired logic. Use the meta-block to document the code for endpoint creation.
package com.example;
public class HelloController {
/**
* ---
* $method=get
* $path=/hello
* $content-type=application/text
* ---
*/
public String hello(String nameParam) {
return "Hello, %s!".formatted(nameParam);
}
}
- Run the Application: Create a main method to run the application:
import io.github.surajkumar.wazei.Wazei;
public class Main {
public static void main(String[] args) throws Exception {
Wazei.init("localhost", 8080);
}
}
- Build and Run:
Run
gradle build
to initiate parsing and initialization at Compile Time. After building, generate the.jar
usinggradle jar
.
You can also creates controllers without the comments using the WazeiRunnerNoConfig
:
public class HelloController {
public String greet(String name) {
return "Hello, %s!".formatted(nameParam);
}
}
To call this controller simply visit: http://localhost:8080/HelloController/greet?name=Bob
Please be aware that this repository is still in its early stages of development. Continuous enhancements and improvements will be made over time to align with project needs and requirements.
Contributions to this project are welcome. If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a dedicated branch for your feature or bug fix.
- Implement your changes and include tests if applicable.
- Submit a pull request.