slight cleanup, remove thread sleep, low risk of spinning

This commit is contained in:
Daniel
2024-10-23 20:50:38 +03:00
parent 707f726b1c
commit da5e8d8c9a
3 changed files with 8 additions and 16 deletions

View File

@@ -4,20 +4,14 @@ import org.lumijiez.core.http.HttpServer;
public class Main {
public static void main(String[] args) {
HttpServer httpServer = new HttpServer(8080);
HttpServer server = new HttpServer(8080);
httpServer.GET("/hello", (req, res) -> {
res.sendResponse(200, "Hello, World!");
});
server.GET("/hello", (req, res) -> res.sendResponse(200, "Hello, World!"));
httpServer.GET("/goodbye", (req, res) -> {
res.sendResponse(200, "Goodbye, World!");
});
server.GET("/goodbye", (req, res) -> res.sendResponse(200, "Goodbye, World!"));
httpServer.POST("/data", (req, res) -> {
res.sendResponse(200, "Data received");
});
server.POST("/data", (req, res) -> res.sendResponse(200, "Data received"));
httpServer.start();
server.start();
}
}