From 07e1f0b679787339efd443a511ec2eee633ce25c Mon Sep 17 00:00:00 2001 From: Araozu Date: Mon, 6 May 2024 14:30:53 -0500 Subject: [PATCH] Rename routes to contain the prefix /api --- src/JuegoWS.kt | 2 +- src/MetodosJuego.kt | 4 ++-- src/Usuarios.kt | 4 ++-- src/WSSala.kt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/JuegoWS.kt b/src/JuegoWS.kt index 786d593..ecff28a 100644 --- a/src/JuegoWS.kt +++ b/src/JuegoWS.kt @@ -18,7 +18,7 @@ data class DatosLlamarSeq( fun Routing.juegows() { - webSocket("/juego") { + webSocket("/api/juego") { for (frame in incoming) when (frame) { is Frame.Text -> { diff --git a/src/MetodosJuego.kt b/src/MetodosJuego.kt index 9dcf848..45cc263 100644 --- a/src/MetodosJuego.kt +++ b/src/MetodosJuego.kt @@ -12,7 +12,7 @@ data class DataCrearJuego(val idUsuario: String) fun Routing.crearJuego() { - post("/partida") { + post("/api/partida") { var sigId = GestorJuegos.generarId() while (GestorJuegos.juegos.containsKey(sigId)) { sigId = GestorJuegos.generarId() @@ -24,7 +24,7 @@ fun Routing.crearJuego() { call.respondText("{\"id\": \"$sigId\"}", contentType = ContentType.Application.Json) } - post("/partida-join") { + post("/api/partida-join") { val infoJuego = call.receive() if (infoJuego.id.length != 6) { call.respondText("{\"error\": \"ID invalido.\"}", contentType = ContentType.Application.Json) diff --git a/src/Usuarios.kt b/src/Usuarios.kt index 6ff7fb8..c90d5b3 100644 --- a/src/Usuarios.kt +++ b/src/Usuarios.kt @@ -11,13 +11,13 @@ data class UsuarioValidar(val nombreUsuario: String, val idUsuario: String) fun Routing.usuarios() { - post("/usuario/crear") { + post("/api/usuario/crear") { val nombreUsuario = call.receive().nombreUsuario val idUsuario = GestorUsuarios.crearUsuario(nombreUsuario) call.respondText("{\"id\": \"$idUsuario\"}", contentType = ContentType.Application.Json) } - post("/usuario/validar") { + post("/api/usuario/validar") { val datos = call.receive() val nombreUsuarioValidado = GestorUsuarios.validarUsuario(datos.idUsuario) if (nombreUsuarioValidado != null) { diff --git a/src/WSSala.kt b/src/WSSala.kt index 385ea51..5257665 100644 --- a/src/WSSala.kt +++ b/src/WSSala.kt @@ -11,7 +11,7 @@ data class ConexionNueva(val idJuego: String, val idUsuario: String) fun Routing.wssala() { val gson = Gson() - webSocket("/socket") { + webSocket("/api/socket") { for (frame in incoming) { when (frame) {