This file describes how to build Exograph locally (for example, to contribute to the project).
Must have:
Nice to have:
- cargo-watch (
cargo install cargo-watch
)
Follow the instructions in Exograph VSCode Extension repo.
Build the exo
and exo-server
binaries:
cargo build
To create a production build:
cargo build --release
By default, cargo will build the exo-server
binary with statically linked plugins. If you want to build a binary that dynamically links these plugins, you can use the --no-default-features
flag:
cargo build --no-default-features
You can also selectively enable static linking for either Postgres or Deno:
cargo build --no-default-features --features static-postgres-resolver
cargo build --no-default-features --features static-deno-resolver
cargo build --no-default-features --features static-wasm-resolver
cargo build && cargo test
cargo build && EXO_RUN_INTROSPECTION_TESTS=true cargo run --bin exo test integration-tests
cd integration-tests/basic-model-no-auth
cargo run --bin exo yolo
You will see URLs for the GraphQL playground and GraphQL endpoint. You can use the playground to run queries and mutations against the endpoint.
- Switch to an example Exograph project directory (such as
integration-tests/basic-model-no-auth
)
cd integration-tests/basic-model-no-auth
- Create a test database
createdb concerts-db
- Start the server
EXO_JWT_SECRET="abcd" EXO_POSTGRES_URL=postgresql://localhost:5432/concerts-db EXO_POSTGRES_USER=$USER cargo run --bin exo dev
During development, it is nicer to use cargo watch
and let compilation and restart the server automatically with any source changes.
EXO_JWT_SECRET="abcd" EXO_POSTGRES_URL=postgresql://localhost:5432/concerts-db EXO_POSTGRES_USER=$USER cargo watch -cx "run --bin exo dev"
Please see CLI Reference for options such as setting paths for the GraphQL playground and query endpoint.
The code is instrumented using the tracing framework and will output log events to the console by default. For more details, including setting logging levels and using OpenTelemetry, see the Exograph telemetry documentation.