Simplicity First👀
Only Function Needed,NO Annotation NO Predefined Setting.
Netty-Powered💪
Enjoy The Speed Of Netty.
Light🏂
Interface Is Function.
Fast🚀🚀🚀
Faster Than Others.
🛠 Install
Important
JDK Minimum Requirements 8
Add Windward library
Add JSON library
🚀 Run
Windward.setup()
// Register router group
.group("/v1")
.get(
"/hello-world",
simpleWindwardContext -> {
simpleWindwardContext.writeString("Hello World!");
})
// Register dynamic router
.get(
"/user/{id}",
simpleWindwardContext -> {
Object o = simpleWindwardContext.getPathVariables().get("id");
simpleWindwardContext.writeString(String.valueOf(o));
})
.end()
// Register webSocket
.ws(
"/ws",
webSocketWindwardContext -> {
if (!webSocketWindwardContext.isUpgradedContext()) {
webSocketWindwardContext.writeString("Unsupported protocol");
}
switch (webSocketWindwardContext.getWebSocketEvent()) {
case ON_CONNECT:
webSocketWindwardContext.writeString("Hello World!");
break;
case ON_MESSAGE:
Object webSocketData =
webSocketWindwardContext.getWebSocketData();
webSocketWindwardContext.writeString("Oh?");
break;
default:
}
})
.then()
// Host static files
.resource("/**.js", "/**.css", "/**.jpeg", "/**.png")
.run();