Code Monkey home page Code Monkey logo

sample-donkey-api's Introduction

Sample Clojure web api

GitHub CI Coverage Status

This is a sample Clojure web api that will:

  • Display a swagger page.
  • Validate or reject http requests based on a schema.
  • Do an async http request to resolve the client's IP address.
  • Map the request to a Kafka proto message.
  • Enqueue and publish that message.
  • Integration tests, relying on testcontainers.

Requirements

Installation

$ lein protodeps generate
$ lein uberjar

Usage

$ java -jar sample-donkey-api-0.1.0-standalone.jar

Configuration

The configuration is loaded using walmartlabs/dyn-edn.
These parts are configurable:

export CHANNEL_SIZE_PER_CORE=250
export KAFKA_BROKERS=my-broker:9093
export IP_STACK_ACCESS_KEY=CHANGE ME
export INTERNAL_PORT=8081
export EXTERNAL_PORT=8080

Used libraries

Examples

$ export KAFKA_BROKERS=my-broker:9092
$ lein uberjar
$ java -jar target/uberjar/sample-donkey-api-0.1.0-SNAPSHOT-standalone.jar
.. in another terminal session
$ curl --location --request POST 'http://localhost:8080/api/v1.0/stocks/order/AAPL' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "amount_usd": 3.47,
  "request_id": "71dad7da-7926-40d8-9b15-b94a6d46e15a",
  "ip": "35.244.183.10",
  "direction": "buy"
  }'

Testing

  • lein test - To run all unit & integration tests.

License

Copyright © 2021 Yevgeni Tsodikov

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.

This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.

sample-donkey-api's People

Contributors

evg-tso avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

asafch

sample-donkey-api's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/push_ci.yml
  • actions/checkout v4.1.4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/checkout v4.1.4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/checkout v4.1.4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • nvuillam/mega-linter v7.3.0
  • actions/upload-artifact v4
  • actions/checkout v4.1.4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/setup-java v4.2.1
  • actions/cache v4
  • actions/checkout v4.1.4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/setup-java v4.2.1
  • actions/cache v4
  • EnricoMi/publish-unit-test-result-action v1.40
  • coverallsapp/github-action v2.2.3@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
  • cljkondo/clj-kondo 2024.03.13-alpine
  • abogoyavlensky/cljstyle 0.15.0
leiningen
project.clj
  • org.clojure:clojure 1.11.3
  • funcool:promesa 11.0.678
  • metosin:malli 0.16.1
  • commons-validator:commons-validator 1.8.0
  • com.appsflyer:donkey 0.5.2
  • metosin:reitit 0.6.0
  • ring:ring-core 1.12.1
  • integrant:integrant 0.9.0
  • com.walmartlabs:dyn-edn 0.2.0
  • com.brunobonacci:mulog 0.9.0
  • nonseldiha:slf4j-mulog 0.2.1
  • com.appsflyer:ketu 1.0.0
  • com.google.protobuf:protobuf-java 3.25.3
  • com.appsflyer:pronto 2.1.2
  • org.clojure:core.async 1.6.681
  • criterium:criterium 0.4.6
  • cloverage:cloverage 1.2.4
  • clj-test-containers:clj-test-containers 0.7.4
  • org.testcontainers:kafka 1.19.7
  • lein-eftest:lein-eftest 0.6.0
  • lein-cloverage:lein-cloverage 1.2.4
  • com.appsflyer:lein-protodeps 1.0.5

  • Check this box to trigger a request for Renovate to run again on this repository

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>whitesource/merge-confidence:beta)

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.