I am creating a mini game on Minecraft.
I installed the Spark dependency to create a web API from the game.
I bought a VPS on OVH under the ip 151.80.XXX.XXX
I installed a pterodactyl panel to facilitate the creation of the server.
Problem:
I can not access my Spark web api. It conflicts despite the change of host or port.
Here is my code
Spark.port(Config.getInt("api_port"));
Spark.before((request, response) -> {
response.header("Access-Control-Allow-Origin", "*");
response.header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
response.header("Access-Control-Allow-Headers", "Content-Type, Authorization");
response.header("Content-Encoding", "UTF-8");
});
Spark.get("/infos", (request, response) -> "Connected");
If I enter the IP of my VPS, I get a “failed to bind address” error. Can you help me? THANKS.