Giter Site home page Giter Site logo

tummy-truck's Introduction

Tummy Truck

alt text

REST API to simulate part of an online food ordering system.


Technologies Used

  • Spring
  • Hibernate
  • MySQL
  • Ehcache
  • Tomcat
  • Maven
  • Log4j
  • Jersey

Steps to Setup and Run

  1. Install Tomcat (or any application server)
  2. Install MySQL
  3. Create a Database called 'tummytruck' using following command
    CREATE DATABASE tummytruck;
    USE tummytruck;
  4. Run the MySQL script to create the necessary tables. Script is at init.sql
  5. Update the user credetials for MySQL in spring-hibernate-jersey2.xml
  6. Update the log location at log4j.properties
  7. Change the overflow filesystem location for ehcache at ehcache.xml
  8. Go to project directory and run following command on terminal
    mvn clean install
  9. It should build the war inside the target location.
  10. Place that war inside the webapps directory in your tomcat location.
  11. Now, you can run the REST APIs using any REST Client (Postman, Advanced REST Client, or DHC REST Client)
  12. Enjoy!

Notes on implementation details

  • I started with working on basic details and structure of REST by implementing the GET, PUT, DELETE, with few more.
  • Used sub-resources for linking Restaurants with Menu and with MenuItems.
  • Implemented find feature to make it easier for user to search by name or part of name.
  • Added second level caching using ehcache3 to boost performance and offload the database.
  • I believe how much of consistency tuning can be done, depends largely on what kind of website or product we are trying to build. For example, something like in a Bank firm we don't want to loosen up consitency of data (Hence, prefer SQL). Whereas in say Zappos, we can go with lower value of consistency to improve the performace to support high read rate (Hence, prefer NoSQL).
  • Currenly I'm using Hibernate with MySQL and ehcache to have cache for each entity. I think, I can try with intergrating with Cassendra background as well.
  • I've used the exception wrapper for handling exception and I've also created custom exceptions to customize how we should be handling in different scenarios.
  • I tried to write as much JUnits possible, I think I wrote about 36ish. I've used JMockito framework, Since I feel more confortable with it and I believe it's more readable.
  • I'm logging the exceptions using log4j, with customization properties.
  • I've added the pom.xml for the project including all the libraries used. I've used Java 1.8 for development on my system with MySQL 5.7.21 and Tomcat 9.0.4 and coding on Eclipse Oxygen.

API Doc

Please refer to this file API-Doc.md

tummy-truck's People

Contributors

param17 avatar

Forkers

heyhiren

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.