Implement a TODO-app as a CLI tool using:
Clone the repository:
git clone https://github.com/flavioespinoza/graphql-go.git
Ensure dependencies are available and up-to-date:
cd graphql-go/cli-app
dep ensure -update
To run the example, you need the Prisma CLI. Please install it via Homebrew or using another method:
brew install prisma
brew tap
For this example, you'll use a free demo database (AWS Aurora) hosted in Prisma Cloud. To set up your database, run:
prisma deploy
Then, follow these steps in the interactive CLI wizard:
- Select Demo server
- Authenticate with Prisma Cloud in your browser (if necessary)
- Back in your terminal, confirm all suggested values
Alternative: Run Prisma locally via Docker
- Ensure you have Docker installed on your machine. If not, you can get it from here.
- Create
docker-compose.yml
for MySQL (see here for Postgres):version: '3' services: prisma: image: prismagraphql/prisma:1.34 restart: always ports: - "4466:4466" environment: PRISMA_CONFIG: | port: 4466 databases: default: connector: mysql host: mysql port: 3306 user: root password: prisma migrations: true mysql: image: mysql:5.7 restart: always environment: MYSQL_ROOT_PASSWORD: prisma volumes: - mysql:/var/lib/mysql volumes: mysql:
- Run
docker-compose up -d
- Set the
endpoint
inprisma.yml
tohttp://localhost:4466
- Run
prisma deploy
You can now use Prisma Admin to view and edit your data by appending /_admin
to your Prisma endpoint.
Run using go
go run main.go
Add a Todo
item
go run main.go create Groceries
List all Todo
items
go run main.go list
Delete a Todo
item
go run main.go delete Groceries