git-bug/api/graphql/gen_graphql.go
Michael Muré 2ab6381a94
Reorganize the webUI and API code
Included in the changes:
- create a new /api root package to hold all API code, migrate /graphql in there
- git API handlers all use the cache instead of the repo directly
- git API handlers are now tested
- git API handlers now require a "repo" mux parameter
- lots of untangling of API/handlers/middleware
- less code in commands/webui.go
2020-06-27 23:03:05 +02:00

34 lines
591 B
Go

// +build ignore
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"github.com/99designs/gqlgen/api"
"github.com/99designs/gqlgen/codegen/config"
"github.com/pkg/errors"
)
func main() {
fmt.Println("Generating graphql code ...")
log.SetOutput(ioutil.Discard)
cfg, err := config.LoadConfigFromDefaultLocations()
if os.IsNotExist(errors.Cause(err)) {
cfg = config.DefaultConfig()
} else if err != nil {
_, _ = fmt.Fprintln(os.Stderr, err.Error())
os.Exit(2)
}
if err = api.Generate(cfg); err != nil {
_, _ = fmt.Fprintln(os.Stderr, err.Error())
os.Exit(3)
}
}