All Projects → theiterators → Akka Http Microservice

theiterators / Akka Http Microservice

Licence: mit
Example of http (micro)service in Scala & akka-http

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to Akka Http Microservice

Kebs
Scala library to eliminate boilerplate
Stars: ✭ 113 (-83.88%)
Mutual labels:  akka, akka-http, boilerplate
Go Restful Api
An idiomatic Go REST API starter kit (boilerplate) following SOLID principles and Clean Architecture
Stars: ✭ 1,043 (+48.79%)
Mutual labels:  microservice, starter-kit, boilerplate
Oh My Fullstack
🚀 Full stack web application skeleton (Next.js, Redux, RxJS, Immutable, Express)
Stars: ✭ 99 (-85.88%)
Mutual labels:  starter-kit, boilerplate, skeleton
Akka Management
Akka Management is a suite of tools for operating Akka Clusters.
Stars: ✭ 218 (-68.9%)
Mutual labels:  microservice, akka, akka-http
Express Typescript Boilerplate
A delightful way to building a RESTful API with NodeJs & TypeScript by @w3tecch
Stars: ✭ 2,293 (+227.1%)
Mutual labels:  starter-kit, boilerplate, skeleton
Project Stub
deps
Stars: ✭ 300 (-57.2%)
Mutual labels:  starter-kit, boilerplate, skeleton
Webpack Boilerplate
A minimal webpack 5 boilerplate with only Babel, SASS and lodash (optional) on board
Stars: ✭ 404 (-42.37%)
Mutual labels:  boilerplate, skeleton
Koa Rest Api Boilerplate
💯 Boilerplate for Node.js Koa RESTful API application with Docker, Swagger, Jest, CodeCov and CircleCI
Stars: ✭ 420 (-40.09%)
Mutual labels:  boilerplate, skeleton
Flower
反应式微服务框架Flower
Stars: ✭ 432 (-38.37%)
Mutual labels:  microservice, akka
Hartija Css Print Framework
Universal CSS for web printing
Stars: ✭ 509 (-27.39%)
Mutual labels:  starter-kit, boilerplate
Js Library Boilerplate Basic
Javascript Minimal Starter Boilerplate - Webpack 5 🚀, Babel 7, UMD, Unit Testing
Stars: ✭ 354 (-49.5%)
Mutual labels:  starter-kit, boilerplate
React Starter Kit
React Starter Kit — front-end starter kit using React, Relay, GraphQL, and JAM stack architecture
Stars: ✭ 21,060 (+2904.28%)
Mutual labels:  boilerplate, starter-kit
Akka Http Json
Integrate some of the best JSON libs in Scala with Akka HTTP
Stars: ✭ 530 (-24.39%)
Mutual labels:  akka, akka-http
Preact Starter
Webpack3 boilerplate for building SPA / PWA / offline front-end apps with Preact
Stars: ✭ 384 (-45.22%)
Mutual labels:  starter-kit, boilerplate
Go Api Boilerplate
Go Server/API boilerplate using best practices DDD CQRS ES gRPC
Stars: ✭ 373 (-46.79%)
Mutual labels:  starter-kit, boilerplate
Akka Http Session
Web & mobile client-side akka-http sessions, with optional JWT support
Stars: ✭ 429 (-38.8%)
Mutual labels:  akka, akka-http
Akka Grpc
Akka gRPC
Stars: ✭ 361 (-48.5%)
Mutual labels:  akka, akka-http
Universal Redux Template
A clean, extensible react + redux boilerplate with universal/isomorphic rendering, testing and more
Stars: ✭ 471 (-32.81%)
Mutual labels:  starter-kit, boilerplate
Redux Webpack Es6 Boilerplate
A starter project for modern React apps with Redux
Stars: ✭ 566 (-19.26%)
Mutual labels:  starter-kit, boilerplate
Python Flask Microservice
Skeleton of a Microservice built with the Flask
Stars: ✭ 544 (-22.4%)
Mutual labels:  microservice, skeleton

Akka HTTP microservice example

Join the chat at https://gitter.im/theiterators/akka-http-microservice GitHub license Build Status

Hot update: Experimental Scala 3 version!

This project demonstrates the Akka HTTP library and Scala to write a simple REST (micro)service. The project shows the following tasks that are typical for most Akka HTTP-based projects:

  • starting standalone HTTP server,
  • handling file-based configuration,
  • logging,
  • routing,
  • deconstructing requests,
  • unmarshalling JSON entities to Scala's case classes,
  • marshaling Scala's case classes to JSON responses,
  • error handling,
  • issuing requests to external services,
  • testing with mocking of external services.

The service in the template provides two REST endpoints - one which gives GeoIP info for given IP and another for calculating geographical distance between given pair of IPs. The project uses the service ip-api which offers JSON IP and GeoIP REST API for free for non-commercial use.

If you want to read more thorough explanation, check out tutorial.

Deploy to Heroku

Usage

Start services with sbt:

$ sbt
> ~reStart

With the service up, you can start sending HTTP requests:

$ curl http://localhost:9000/ip/8.8.8.8
{
  "city": "Mountain View",
  "query": "8.8.8.8",
  "country": "United States",
  "lon": -122.0881,
  "lat": 37.3845
}
$ curl -X POST -H 'Content-Type: application/json' http://localhost:9000/ip -d '{"ip1": "8.8.8.8", "ip2": "93.184.216.34"}'
{
  "distance": 4347.624347494718,
  "ip1Info": {
    "city": "Mountain View",
    "query": "8.8.8.8",
    "country": "United States",
    "lon": -122.0881,
    "lat": 37.3845
  },
  "ip2Info": {
    "city": "Norwell",
    "query": "93.184.216.34",
    "country": "United States",
    "lon": -70.8228,
    "lat": 42.1508
  }
}

Testing

Execute tests using test command:

$ sbt
> test

Author & license

If you have any questions regarding this project contact:

Łukasz Sowa [email protected] from Iterators.

For licensing info see LICENSE file in project's root directory.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].