DEV Community

Takahiro Kudo
Takahiro Kudo

Posted on

Note: graphql-go Tutorial

I did graphql-go Tutorial and had a little trouble. Therefore I share my note.

Getting started

https://www.howtographql.com/graphql-go/1-getting-started/

validation failed: packages.Load error occured.
To fix it, setup go module.

% cd <project dir>
% go mod init
% go get github.com/99designs/gqlgen

# This module is needed.
% go get github.com/vektah/gqlparser/v2

%gqlgen init
Enter fullscreen mode Exit fullscreen mode

Database

https://www.howtographql.com/graphql-go/4-database/

server.go needs go-chi.

% go get github.com/go-chi/chi
Enter fullscreen mode Exit fullscreen mode

Testing query and mutation.

We can test on browser UI which URL is http://localhost:8080.

Codes

https://github.com/takakd/graphql-go-tutorial

Top comments (0)