Table of Contents
- What is Flogo ?
- What is GraphQL ?
- Creating the Application
- Testing the Application with Various Queries
Project Flogo is a resource efficient, Go-based open source ecosystem for building event-driven integration apps. Flogo flows can be visually configured to implement integration applications very quickly, hence reducing time to market. For more information on Flogo and getting started with it's development have a look at this article:
TIBCO Cloud Integration Getting Started with Develop
What is GraphQL ?
GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools. For more information see:
Creating the Application
Now we know what Flogo and GraphQL is, let's get started. First we will create a new Empty Flogo Application:
You can provide a name for your application in the left top. In the next step we will create new Flogo flows based on the GraphQL Schema:
You can Drag and Drop the schema onto the canvas to get started. I used this example schema:
https://github.com/project-flogo/graphql/blob/master/samples/Example2.gql
Now all the flows will automatically be generated:
Now we need to create the implementation of these processes, in this application we make use of shared data to store the added post to the Application Scope. Therefore it is important to select application scope on the shared data activity:
Now we can deploy the application and test it with queries. You can download the Flogo Json Attached to this Article
Testing the Application with Various Queries
For this we will use PostMan to test but if you don't have PostMan you can also test your queries online, by using this website for example:
https://www.graphqlbin.com/v2/new
When the app is deployed we need to get the endpoint URL, which we can copy in the UI:
Now in PostMan we create a new Request and it is important to add the endpoint of the trigger to the copied endpoint. We can get the trigger endpoint at the trigger configuration:
So the endpoint we use in PostMan is for example:
https://eu-west-1.integration.cloud.tibcoapps.com/xyz/graphql
Now we can use the following Mutation to add a post:
mutation { CreatePost (postObj: { title: "My First Post" body: "This is my first post" userId: 123 }) {postId} }
The result will look like this:
And after we have created some posts, we can query the created posts with the following query:
{ GetPosts(userId: 123) { title, body, postId, } }
The result will look somewhat like this:
Congratulations you have now created a Flogo App that does GraphQL Queries and Mutations !
Hugo Peters - Product Management
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now