Code Monkey home page Code Monkey logo

kotlin-ktor-exposed-sample-api's Introduction

Kotlin Ktor Exposed Sample API

Build Status

Sample Employee API is written in Kotlin and uses Ktor async framework and uses Exposed Kotlin SQL Framework

Sample Employee API allows basic CRUD operations (immutable database) via REST API and JSON as data exchange format.

Sample Employee Api by default uses H2 database but can be changed to Postgres by passing DB_TYPE=postgres environment variable. The connection settings can also be passed via environment variables (please check application.conf to see what variables can be overridden).

Database tables are migrated at deployment via Flyway and scripts can be added in db/migrations folder to add new tables or execute queries like inserting data etc on server startup.

EmployeeApiTest runs end to end test to make sure all api endpoints perform as expected.

Logs are written to console and can be redirected using tee process. Logging with MDC (UUID) for tracing purpose and returning MDC UUID in case of error in API response.

Running the application via docker

docker-compose up

Metrics

The Metrics feature allows you to configure the Metrics to get useful information about the server and the requests.

Run jconsole on command line and choose EmployeeApiServerKt.

Click on metrics folder to get server performance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.