dantimofte / gographql

Golang backend with graphql and mongodb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Golang backend with graphql and mongodb

The project is based on the guide from howtographql.com/graphql-go

Differences :

- It uses mongodb instead of mysql
- Login is setting the jwt token as cookie , no extra work required in the frontend
- Added logout mutation

Start the graphql backend

go get
go run ./server.go

queries and mutations

mutation {
  createUser(input: {username: "user1", password: "123"})
}


mutation {
  login(input: {username: "user1", password: "123"})
}

mutation {
  logout(input: {info:true})
}

mutation {
  createLink(input: {title: "real link!", address: "www.graphql.org"}){
    user{
      name
    }
  }
}

query {
  links {
    title
    address
    id
  }
}

About

Golang backend with graphql and mongodb


Languages

Language:Go 100.0%