Skip to content
Kristiqn Tachev edited this page Mar 6, 2021 · 1 revision

Gapi CLI

Overview

The Gapi CLI is a tool to initialize, develop and maintain Gapi applications

Getting Started

To install Gapi CLI:

npm install -g @gapi/cli

Generating and serving an Gapi project via a development server Create and run a new project:

gapi new my-project
cd my-project
gapi start

Navigate to http://localhost:9000/graphiql. The app will automatically reload if you change any of the source files.

Running Unit tests and E2E tests

Run single test iteration
Will take config > test > local configuration inside gapi-cli.conf.yml
gapi test

Tests will execute after starting application and executed via Jest, and it will automatically watch your files for changes. You can run tests a single time via "gapi test".

Run tests in watch mode
gapi test --watch
Run tests with different environment
It will take configuration from gapi-cli.conf.yml
You can extend configurations from APP when you write after environment "extends app/my-environment"

Custom testing environments

config:
  app:
    local: 
      API_PORT: 9000
      API_CERT: ./cert.key
      NODE_ENV: development
      AMQP_HOST: 182.10.0.5
      AMQP_PORT: 5672
      ENDPOINT_TESTING: http://localhost:9000/graphql
      TOKEN_TESTING: ''
    prod: 
      API_PORT: 9000
      API_CERT: ./cert.key
      NODE_ENV: production
      AMQP_HOST: 182.10.0.5
      AMQP_PORT: 5672
      ENDPOINT_TESTING: http://182.10.0.101:9000/graphql
      TOKEN_TESTING: ''
    my-environment: 
      API_PORT: 9000
      API_CERT: ./cert.key
      NODE_ENV: development
      AMQP_HOST: 182.10.0.5
      AMQP_PORT: 5672
      ENDPOINT_TESTING: http://localhost:9000/graphql
      TOKEN_TESTING: ''
  test:
    my-environment: extends app/my-environment
    local: extends app/local
    prod: extends app/prod
    worker:
      API_PORT: 9000
      API_CERT: ./cert.key
      NODE_ENV: production
      AMQP_HOST: 182.10.0.5
      AMQP_PORT: 5672
      ENDPOINT_TESTING: http://182.10.0.101:9000/graphql
      TOKEN_TESTING: ''
Running with Testing worker environment
gapi test --worker

Running with Production environment

gapi test --prod
Running with custom enviroment
gapi test --my-enviroment