GithubHelp home page GithubHelp logo

tyumener / car-adverts Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.03 MB

REST-full web api in Scala

Home Page: http://ec2-52-57-155-217.eu-central-1.compute.amazonaws.com:9000/adverts

License: Other

Scala 100.00%

car-adverts's Introduction

Car Adverts web service

REST-full web service written in Scala using Play Framework.

The application is deployed on AWS.

Constraints

  • Scala as a programming
  • Play 2.4.x as a web framework
  • DynamoDB for a persistence storage

Assumptions

  • The application is a prototype
    • Not necessary to produce high quality documentation, it's enough just to have a list of sample requests that show how the system works
    • Not necessary to have a possibility to scale the application horizontally, one server is enough
    • Not necessary to use a strict coding style
  • The application is to be used internally by a small group of people:
    • No Authentication and Authorization is required
  • The application should not be designed for high load and high data volumes, therefore it's:
    • Not necessary to use async communication with a persistence storage
    • Not necessary to use server-side caching
    • Data can be sorted in memory on the server

Non-functional requirements

  • Since it's a prototype there're no defined requirements for performance (latency and throughput), availability, modifiability.

Features

Current features

  • has functionality to return list of all car adverts:
curl http://ec2-52-57-155-217.eu-central-1.compute.amazonaws.com:9000/adverts
  • optional sorting by any field specified by query parameter:
    curl http://ec2-52-57-155-217.eu-central-1.compute.amazonaws.com:9000/adverts?sortBy=id
    curl http://ec2-52-57-155-217.eu-central-1.compute.amazonaws.com:9000/adverts?sortBy=title
    curl http://ec2-52-57-155-217.eu-central-1.compute.amazonaws.com:9000/adverts?sortBy=price
    curl http://ec2-52-57-155-217.eu-central-1.compute.amazonaws.com:9000/adverts?sortBy=mileage
    curl http://ec2-52-57-155-217.eu-central-1.compute.amazonaws.com:9000/adverts?sortBy=fuel
    curl http://ec2-52-57-155-217.eu-central-1.compute.amazonaws.com:9000/adverts?sortBy=firstRegistration
  • has functionality to return data for single car advert by id:
curl http://ec2-52-57-155-217.eu-central-1.compute.amazonaws.com:9000/adverts/1
  • if advert not exist 404 status code will be returned:
curl -v http://ec2-52-57-155-217.eu-central-1.compute.amazonaws.com:9000/adverts/2
  • has functionality to add car advert:
curl -v -X POST http://ec2-52-57-155-217.eu-central-1.compute.amazonaws.com:9000/adverts -H 'content-type: application/json' -d '{"id":33,"title":"Opel Astra","fuel":"diesel","price":25000,"isNew":true}'
  • has functionality to modify car advert by id:
curl -v -X PUT http://ec2-52-57-155-217.eu-central-1.compute.amazonaws.com:9000/adverts/33 -H 'content-type: application/json' -d '{"id":33,"title":"Opel Astra","fuel":"diesel","price":24999,"isNew":true}'
  • has functionality to delete car advert by id:
curl -v -X DELETE http://ec2-52-57-155-217.eu-central-1.compute.amazonaws.com:9000/adverts/33
  • has validation
  • accepts and returns data in ISO 8601 UTC
  • data is stored in the DynamoDB table

Possible future features

  • Pagination for the GET /adverts endpoint. Would be nice to introduce optional parameters: page size and page number
  • Descending order sorting for the GET /adverts endpoint
  • Local caching for the GET requests
  • HATEOS
  • Clean the codebase
    • Implement Unit of work pattern to support transactions
    • Impletemt the rest of tests
    • Configure Sonarqube and run the analysis of the codebase

How to run locally

  1. Clone the repository.
  2. Install latest versions of JDK and SBT
  3. Create a file with AWS credentials as described here. Please contact me to get the values for "aws_access_key_id" and "aws_secret_access_key".
  4. Open the directory with the application
  5. Run:
sbt run

car-adverts's People

Contributors

tyumener avatar

Watchers

 avatar  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.