NFramework is a simple, annotation-based networking framework that enables seamless client-server communication using a custom request-response model. It allows direct method invocation on the server, making it an efficient alternative for lightweight applications.
π₯ Features
βοΈ Annotation-based API for defining endpoints.
βοΈ Custom request-response model for optimized performance.
βοΈ Automatic method invocation on the server.
βοΈ Lightweight and dependency-free β only requires the included JARs.
βοΈ Simple client execution with execute()
calls.
π Installation
1οΈβ£ Download the JAR Files
Get the latest NFramework Server & Client JARs from this release.
2οΈβ£ Include Them in Your Project
Run the server and client using the following commands:
# Running the server
java -cp nframework-server.jar BankService
# Running the client
java -cp nframework-client.jar BankClient
3οΈβ£ Implement Your API
Use simple annotations to define server methods.
π Example Usage
π₯οΈ Server Code
π₯ Required Imports
import com.thinking.machines.nframework.server.*;
import com.thinking.machines.nframework.server.annotations.*;
π Implementation
@Path("/banking")
public class BankService {
@Path("/branchName")
public String getBranch(String city) {
return city.equals("Mumbai") ? "Colaba" : "Unknown Branch";
}
}
π» Client Code
π₯ Required Imports
import com.thinking.machines.nframework.client.*;
π Implementation
NFrameworkClient client = new NFrameworkClient();
String branch = (String) client.execute("/banking/branchName", "Mumbai");
System.out.println("Branch: " + branch);
β‘ Future Improvements
πΉ Configurable ports (currently hardcoded to 5500
).
πΉ Improved error handling for better debugging.
πΉ Async request handling for better performance.
π’ Try it out and let us know your feedback! π