3. Query by GraphQL



In Galaxy Web, we use GraphqQL to query data from backend endpoints, and to support GraphqQL, we use Vue Apollo. Also, a playground is created for you to find all APIs and try writing your own queries in it.

Here's an example:

Suppose we want to get an example campaign listed in http://localhost:3454/AlphaFinanceLab as the screenshot shows below.

Document image



First, we need to write a query schema under the path src/graphql/queries/. For this query, we use the file src/graphql/queries/Dao.gql. 

Dao.gql

You can modify the schema referencing https://graphigo.stg.galaxy.eco to query any field you want.

Note: Remember to run command npm run gql:types every time after you add/modify any schema files, and the updated types for schema will be stored in src/graphql/types.ts.

Then, we need to add an Apollo Query for component. To do this, see in file src/views/Activities.vue.

Activities.vue

Now, run the project, go to http://localhost:3454/AlphaFinanceLab to see it, it should show something similar to what we see at first.