GithubHelp home page GithubHelp logo

fatihcataltepe / internal_api Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 24 KB

A simple web service implementation using akka-http and scala.

Scala 100.00%
scala akka-http webservice money-transfer

internal_api's Introduction

Internal api

This project is implemented to simulate a simple web service enables money transaction between registered users.

Building and running

  1. Checkout project from git
  2. Go to project directory: cd /path/to/project/internal-api
  3. Execute the following command: sbt universal:packageBin
  4. internal-api-<version_number>.zip created in the target/universal path. Unzip that .zip file
  5. Go to target/universal/internal-api-<version_number> directory
  6. If you are working on MAC OS X execute chmod +x bin/*
  7. Execute the following command: bin/internal-api to run the application with default configurations. Your web service should be up and running

Configuration

In the target/universal/internal-api-<version_number> directory, there is a conf folder. You will see

  • logback.xml to configure your logging settings
  • application.conf to configure your application settings

Note that with default configurations, the application can already works. However, you can customise if you want.

Application.conf

internal-api = {
  url = 127.0.0.1
  port = 8080
}
name type notes
url string the url in which web server will run
port int the port in which web server will run

Inteface

Since this is a demo project only 1 interface is implemented which enables money transactions between registered users.

  1. GET /money-transaction?from=id_1&to=id_2&amount=amount The route takes 3 mandatory parameters.
name type notes
from string the id of the user who sends the money
to int the id of the user who receives the money
amount double the amount of the money to be transferred
  • The route returns one of the following responses:
{
    "status": "Success",
    "message": "Transaction is completed"
}
{
    "status": "Error",
    "message": "Current account <currAmount> is not sufficient to transfer <transactionAmount>"
}
{
    "status": "Error",
    "message": "Account related to user: <userId> does not exist"
}

Notes

  • A fake data store is implemented and basically stores a map of user and balance tuples. In a real life scenario, this can be replaced with a real database.
  • Unit tests can be found under test directory.

internal_api's People

Contributors

fatihcataltepe avatar

Watchers

 avatar

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.