Skip to content

Example of consuming a GraphQL API within a Java (+ Spring Boot + Vaadin) application

License

Notifications You must be signed in to change notification settings

mstahv/accessing-graphql-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Consuming GraphQL example with Java, Spring Boot & Vaadin

This example app shows how to consume trivial data from a GraphQL API. The GraphQL API is provided by StepZen, and is based on the https://ip-api.com IP Geolocation service.

The example app looks like this: Screenshot

Running the application

The project is a standard Maven project. To run it from the command line, type mvn, then open http://localhost:8080 in your browser. The first launch may take several minutes as front-end build files are not committed to the repository.

You can also import the project to your IDE of choice as you would with any Maven project. Read more on how to set up a development environment for Vaadin projects (Windows, Linux, macOS).

Deploying to Production

To create a production build, call mvn clean package -Pproduction. This will build a JAR file with all the dependencies and front-end resources, ready to be deployed. The file can be found in the target folder after the build completes.

Once the JAR file is built, you can run it using java -jar target/myapp-1.0-SNAPSHOT.jar (NOTE, replace myapp-1.0-SNAPSHOT.jar with the name of your jar).

Project structure

  • MainView.java in src/main/java is an example Vaadin view.
  • src/main/resources contains configuration files and static resources
  • The frontend directory in the root folder is where client-side dependencies and resource files should be placed.

Useful links

About

Example of consuming a GraphQL API within a Java (+ Spring Boot + Vaadin) application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages