Rename routes to contain the prefix /api

master
Araozu 2024-05-06 14:30:53 -05:00
parent 7aa144369a
commit 07e1f0b679
4 changed files with 6 additions and 6 deletions

View File

@ -18,7 +18,7 @@ data class DatosLlamarSeq(
fun Routing.juegows() {
webSocket("/juego") {
webSocket("/api/juego") {
for (frame in incoming) when (frame) {
is Frame.Text -> {

View File

@ -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<InfoJuego>()
if (infoJuego.id.length != 6) {
call.respondText("{\"error\": \"ID invalido.\"}", contentType = ContentType.Application.Json)

View File

@ -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<Usuario>().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<UsuarioValidar>()
val nombreUsuarioValidado = GestorUsuarios.validarUsuario(datos.idUsuario)
if (nombreUsuarioValidado != null) {

View File

@ -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) {