Skip to content

josoder/beerql

Repository files navigation

beerql

beerql is a simple web application using native kotlin only (except for junit for testing)

It uses ktor web framework to serve the API,
exposed with h2 to store the data,
Koin for dependency injection,
and Kgraphql to implement graphql.

Ktor

Ktor is built using gradle and hosted with an embedded Netty server.

Ktor is started with the following line in build.gradle

application { mainClassName = "io.ktor.server.netty.EngineMain" }

As explained by the official docs the EngineMain will pick up the configuration file main/resources

From the official docs:

When Ktor is started using a EngineMain, or by calling the commandLineEnvironment, it tries to load a HOCON file called application.conf from the application resources. You can change the location of the file using command line arguments. (https://ktor.io/servers/configuration.html#available-config).

The application.conf file specifies which module(s) to install and the entry-point of the application launch. the beerql module is defined in Application.kt.

More information about the Ktor lifecycle can be found here.

Setup

  • ./gradlew run

    or run with docker:

  • ./gradlew build
  • docker build -t beerql .
  • docker run -p 8080:8080 --rm beerql

    http://localhost:8080/api/beerql exposes the graphql root

    Use graphiql standalone or the chrome extension in the link below to explore the content

    https://chrome.google.com/webstore/detail/chromeiql/fkkiamalmpiidkljmicmjfbieiclmeij

    Currently there is only 2 queries defined beers(size:Int) and beer(id:Int)

  • About

    Kgraphql served with ktor

    Topics

    Resources

    License

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published