Development Notes
Initial module
go mod init github.com/diep-it-dn/fullstack-go-angular/myapp-backend-go
Create the project skeleton with gqlgen
go get github.com/99designs/gqlgen
go run github.com/99designs/gqlgen init
go run github.com/99designs/gqlgen generate
Note:
- If error is occured, try to run this to fix: `go get github.com/vektah/gqlparser/v2@v2.1.0`, then rerun: `go run github.com/99designs/gqlgen generate`
- We should add git ignore for generated code.
Installation ent
go get entgo.io/ent/cmd/ent
Create Schemas by ent
ent init User
ent init PermissionGroup
ent init ContentSetting
ent init Tag
ent init Post
GraphQL Integration
Refer GraphQL Integration
Run codegen for your ent project
go generate ./...
Development server
At the first time, run make before-dev
to prepare eveything. See the make file for more information. Rerun it when the code changed during the development.
Then in Visual Studio Code, press F5, choose "Launch debugger for myapp-backend-go server"
.
(You can also run make docker-compose-dev
to start the application inside the docker container)
Then browse to http://localhost:9999/playground to send/test queries.