Skip to content

codingconcepts/crdb-graphql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crdb-grpc

A barebones example of accessing CockroachDB via GraphQL

Dependencies

Running locally

Create a cluster

$ cockroach start-single-node \
		--listen-addr=localhost:26257 \
		--http-addr=localhost:8080 \
		--insecure

Create a table

$ cockroach sql --insecure < create.sql

Start the server

$ go run main.go

Requests

Fetch all todos

{
  todos {
    id
    title
  }
}

Fetch one todo

{
  todo(id: "8da8291c-5985-41c9-8069-0de865dd20d7") {
    title
  }
}

Create a todo

mutation CreateTodo($todo: TodoInput!) {
  createTodo(todo: $todo) {
    id
    title
  }
}
{
  "todo": {
  	"title": "todo d"
  }
}

Delete a todo

mutation DeleteTodo($id: ID!) {
  deleteTodo(id: $id)
}
{
  "id": "8da8291c-5985-41c9-8069-0de865dd20d7"
}

About

A barebones example of accessing CockroachDB via GraphQL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages