Skip to content

Repository files navigation

RBFA GraphQL API

RBFA API is an api to help teams from football in brazil to managed his dailies issues. If you want to see the client project, go to here.

Getting Started

This project use graphql, graphql-relay, koa framework, jsonwebtoken and others stuffs;

# clone repo
$ https://github.com/daniloab/rbaf-graphql-api.git
$ cd rbaf-graphql-api
# install dependencies
$ yarn install
# copy .env file
$ cp .env.example .env
# start project
$ yarn start
# see on graphiql graphql interface on localhost link
http://localhost:9001/graphql

Generating the schema

yarn schema

Queries

User

  • All
query {
users {
_idnameusernameemailpassword
}
}
  • Auth
query {
me {
usernamenameusername
}
}

Players

  • All
query {
players {
_idstatusnamelastnamepositiondocument }
}
  • By Id
query {
playerById(_id: "_id") {
_idstatusnamelastnamepositiondocument
}
}

Summary

building, almost there ♥

Mutations

User

  • Login
mutation {
LoginEmail(input: {
email:"jon@jon.com"password:"jonpassword"
}) {
tokenerror
}
}
}
  • Register
mutation {
RegisterEmail(input: {
name: "Ned"username:"nedstark"email:"ned@ned.com"password:"ned123"
}) {
tokenerror
}
}
  • Change Password
mutation {
ChangePassword(input: {
oldPassword:"oldPassword"password:"newPassword"
})
}

Players

  • Register and Update Player - If you add a new player, just pass the inputs withou _id
mutation {
RegisterPlayerMutation(input: {
_id:""status:1,
name:"Sor"lastname:"Jorah"position:"Cornerback"document:"3456576789"
}) {
newPlayer {
_idstatusnamelastnamepositiondocument
}
error
}
}
  • Remove Player
mutation {
RemovePlayer(input:{
_id: "_id"
}) {
namelastnameerror
}
}

About

Backend GraphQL Server.

Resources

Stars

50 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages