Can not acces backend in graphql spring boot application

Can not acces backend in graphql spring boot application


0

Im working on a simple coding challenge that needs to createe a graphql application and save some objects (team,players,competitions and coach).
I´ve never used graphql before so iim relying on sove tutorials on the web like: https://www.bezkoder.com/spring-boot-graphql-mysql-jpa/ and https://medium.com/@memredemir/creating-a-graphql-mysql-and-spring-boot-backend-service-32cec95f4436.

For some reason i cant acces the backend for debug:

Can not acces backend in graphql spring boot application

This is my schema wiith the mutations and the types:

# leagueSchema.graphqls

# Types

type Team {
    id: ID!
    name: String!
    tla: String
    shortName: String
    areaName: String
    address: String
    players: [Player!]
    coach: Coach
    competitions: [Competition!]
}

type Player {
    id: ID!
    name: String!
    position: String!
    dateOfBirth: String! # Utilizando String para representar LocalDate em GraphQL
    nationality: String
    team: Team
}

type Coach {
    id: ID!
    name: String!
    dateOfBirth: String!  # Representando LocalDate como String
    nationality: String
    team: Team
}

type Competition {
    id: ID!
    name: String!
    code: String
    areaName: String
    teams: [Team!]
}

# Queries
type Query {
    getAllTeams: [Team]
    getTeamById(id: ID!): Team
    getAllPlayers: [Player]
    getPlayerById(id: ID!): Player
    getAllCoaches: [Coach]
    getCoachById(id: ID!): Coach
    getAllCompetitions: [Competition]
    getCompetitionById(id: ID!): Competition
}

# Mutations
type Mutation {
    createTeam(name: String!, address: String, areaName: String, shortName: String, tla: String): Team
    createPlayer(name: String!, position: String!, dateOfBirth: String!, nationality: String, teamId: ID!): Player
    createCoach(name: String!, dateOfBirth: String!, nationality: String, teamId: ID!): Coach
    createCompetition(name: String!): Competition
    addTeamToCompetition(teamId: ID!, competitionId: ID!): Competition
    addPlayerToTeam(playerId: ID!, teamId: ID!): Team
    addCoachToTeam(coachId: ID!, teamId: ID!): Team
}

And this is my mutation class:

@Component
public class TeamMutationResolver implements GraphQLMutationResolver {

    @Autowired
    private TeamService teamService;

    public Team createTeam(@Nonnull String name, String address, String areaName, String shortName, String tla) {
        return teamService.createTeam(name, address, areaName, shortName, tla);
    }


    public Team addPlayerToTeam(Long playerId, Long teamId) {
        return teamService.addPlayerToTeam(playerId, teamId);
    }

    public Team addCoachToTeam(Long coachId, Long teamId) {
        return teamService.addCoachToTeam(coachId, teamId);
    }
}

So im trying to debug putting a breakpoint on createTeam method but the request on postman is not reaching the backend. What im missing?

This is the repository in case you want to reproduce:
https://github.com/Romulo-S/TeamLeagueApp/tree/master


Load 5 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *