Code Monkey home page Code Monkey logo

addressbook's Introduction

PWC Address Book

Design / Architecture

I have chosen Spring Boot to create this application. The reason for choosing Spring Boot is its convention over configuration approach and ability to create standalone applications. The frontend has been designed in React.

Project structure was generated using Spring Initializr. React has been used for front end.

Tech-Stack Used to build application:

  1. Spring boot embedded Tomcat Server
  2. In-Memory h2 Database (but can be used with any jdbc compliant database)
  3. Spring Rest
  4. Spring Security
  5. Spring Data Rest
  6. Jackson : Java to Json mapping
  7. Unit Testing Persistence : JPA provided by Hibernate
  8. JUnit : Unit Test Framework
  9. Mockito : Mocking framework
  10. Maven : Build integration
  11. Postman/Curl : testing Rest Services.
  12. React

Note My primary skillset lies around backend services. Though I have done some frontend development using Google GWT and Adobe Flex in the past, but I am not upto date with modern front end technologies like React/Angular etc. The React used in this project is what I learned and applied in two days. I have created a front end for the sake com completeness.

Security Considerations / Assumptions:

  1. Full OAuth based authentication/authorization was not implemented as it was out of scope for this excercise.
  2. REST services are secured using access token, which is hard coded for this application. But in a real world application it will be generated using OAuth etc.
  3. Security services are provided by non-invasive http interceptors.
  4. Only backend has been secured. I considered front end security out of scope for this exercise.

How to run this application

  • Clone the git repo using following command

git clone https://github.com/karwal/addressbook.git

This will create a folder addressbook in your current working directory.

  • Execute command:

cd addressbook

  • Compile code using following command

mvn clean install

  • Run the application using following command

java -jar ./target/addressbook-0.0.1-SNAPSHOT.jar

Note My primary skillset lies around backend services. Though I have done some frontend development using Google GWT and Adobe Flex in the past, but I am not upto date with modern front end technologies like React/Angular etc. The React used in this project is what I learned and applied in two days. I have created a front end for the sake com completeness.

Using application

  • Create few Address Book using any Rest client (I have used Postman/Curl)
curl -d '{"name": "Outlook"}' -H "Content-Type: application/json" -H  "Authorization: abc123" -X POST http://localhost:8080/v1/api/pwc/addressbook/create
curl -d '{"name": "Google"}' -H "Content-Type: application/json" -H  "Authorization: abc123" -X POST http://localhost:8080/v1/api/pwc/addressbook/create
curl -d '{"name": "Yahoo"}' -H "Content-Type: application/json" -H  "Authorization: abc123" -X POST http://localhost:8080/v1/api/pwc/addressbook/create
curl -H "Content-Type: application/json" -H  "Authorization: abc123" -X POST http://localhost:8080/v1/api/pwc/addressbook
  • Run the following endpoint create a contact. Remember to update the addressbook id to the id of an addressbook created in previous step.
curl -d '{"addressBookId" : "1", ""contactName": "Jagdeep1", "contactPhoneNumber" : "0424144966"}' -H "Content-Type: application/json" -H  "Authorization: abc123" -X POST http://localhost:8080/v1/api/pwc/contact/create
curl -d '{"addressBookId" : "2", ""contactName": "Jagdeep1", "contactPhoneNumber" : "0424144967"}' -H "Content-Type: application/json" -H  "Authorization: abc123" -X POST http://localhost:8080/v1/api/pwc/contact/create
curl -d '{"addressBookId" : "3", ""contactName": "Jagdeep1", "contactPhoneNumber" : "0424144968"}' -H "Content-Type: application/json" -H  "Authorization: abc123" -X POST http://localhost:8080/v1/api/pwc/contact/create
curl -d '{"addressBookId" : "1", ""contactName": "Jagdeep2", "contactPhoneNumber" : "0424144969"}' -H "Content-Type: application/json" -H  "Authorization: abc123" -X POST http://localhost:8080/v1/api/pwc/contact/create
curl -d '{"addressBookId" : "2", ""contactName": "Jagdeep3", "contactPhoneNumber" : "0424144970"}' -H "Content-Type: application/json" -H  "Authorization: abc123" -X POST http://localhost:8080/v1/api/pwc/contact/create
curl  -H "Content-Type: application/json" -H  "Authorization: abc123"   -X GET http://localhost:8080/v1/api/pwc/contact?unique=true

Unit Testing

JUnit coverage is provided for controller classes and interceptor class(AuthenticationInterceptor.java) only. There is no JUnit coverage for repository class methods as repository is just an Inteface and implementation is provided by JPA.

References

Author

  • Jagdeep Singh

addressbook's People

Contributors

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