# README
server/control/
This directory contains the implementation of the control server. It mainly stitches together the GraphQL API, permission checks, output formats, etc., as it calls services for most of the actual functionality (see services/
for details).
Stack
These are the main libraries used in the control server
gqlgen
: For defining the GraphQL server. It generates Go files based on GraphQL schema files (see below). Not the most common choice, but it seems many people think it's now the best GraphQL library for Go.goth
: For setting up authentication with Google and Githubchi
: For HTTP routing
Adding GraphQL resolvers in the control server
- Add/update the GraphQL schema files in
server/control/schema
- Run
scripts/gqlgen-control.sh
- This is where it gets a little tricky -- it will generate stubs for all the resolvers in the file
server/control/resolver/generated.go
. You will want to pick out all the types/resolvers that have been updated/changed and add them to one of the other resolver files in the package (e.g. if it's a new user-related query, add it toserver/control/resolver/user
) - When you're done manually merging the new generated resolvers into the existing resolvers, delete the
generated.go
file. Good news: if you mess anything up, the type checker will complain!
# Functions
NewServer returns a new control server.
# Structs
AuthOptions configures Beneath authentication.
Server is the control server.
ServerOptions are the options for creating a control server.