A rewrite of GlobalGym's api using Ktor.
Ktor - Web framework
Jdbi - Database access
VuePress - Routes documentation
Create a PostgreSQL database.
Clone the repository
git clone git@github.com:MarkNjunge/GlobalGym-api-ktor.git
Create an application.conf
in resources based on resources/application.conf.sample
.
cp resources/application.conf.sample resources/application.conf
[Optional] Build the routes documentation. Requires VuePress to be installed.
vuepress build resources\docs
Run the main function in Application.kt
in an IDE, or run the command below in a cli
gradlew run
The application.conf file is the main way of setting configs. Environment variables can also be used and will take priority over the config file.
ENV variable | .conf mapping |
---|---|
PORT | ktor.deployment.port |
DATABASE_URL | database.url |
DATABASE_USERNAME | database.username |
DATABASE_PASSWORD | database.password |
AUTH_KEY | other.authKey |
Build the routes documentation. Requires VuePress to be installed.
vuepress build resources\docs
Build the jar
gradlew shadowJar
You can then run the jar using
java -jar build\libs\globalgym-api.jar
Use the instructions above to first build the jar
Build a docker image
docker build -t globalgym-api .
Run the image
docker run -it -p 3000:3000 --rm globalgym-api