Skip to content

Latest commit

 

History

History
104 lines (67 loc) · 2.83 KB

DEVELOPMENT.md

File metadata and controls

104 lines (67 loc) · 2.83 KB

This file describes how to build Exograph locally (for example, to contribute to the project).

Prerequisites

Must have:

Nice to have:

  • cargo-watch (cargo install cargo-watch)

Installing the vscode extension

Follow the instructions in Exograph VSCode Extension repo.

Building

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

Running tests

Unit tests

cargo build && cargo test

Integration tests

cargo build && EXO_RUN_INTROSPECTION_TESTS=true cargo run --bin exo test integration-tests

Testing the setup

Yolo mode

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.

Dev mode

  1. Switch to an example Exograph project directory (such as integration-tests/basic-model-no-auth)
cd integration-tests/basic-model-no-auth
  1. Create a test database
createdb concerts-db
  1. 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.

Logging, tracing, and telemetry

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.