package com.humanbooster.config; import com.humanbooster.api.ApiApplication; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletContainer; public class ServerConfig { public void startServer() throws Exception { System.out.println("Starting server..."); ResourceConfig config = new ApiApplication(); ServletHolder servlet = new ServletHolder(new ServletContainer(config)); Server server = new Server(80); ServletContextHandler context = new ServletContextHandler(server, "/"); context.setServer(server); context.addServlet(servlet, "/*"); try { server.start(); System.out.println("Server started on port 80"); server.join(); } catch (Exception e) { System.out.println("Failed to start server: " + e.getMessage()); } } }