Giter Site home page Giter Site logo

rest-demo's Introduction

rest-demo

A Spring-Boot application to demo Restful web services using Spring MVC, and an Angular JS client.

Deployed demo URL : http://fierce-retreat-62806.herokuapp.com/

##Running the application

You need JDK 1.8 installed to run this application.

Once that basic requirement is filled, you can run the application using maven by running this simple command mvn spring-boot:run

##Server Server side rest operations can be accessed by the /company namespace.

###Functionality The application uses a simple in-memory datastore instead of connencting to a database to store the data. This would of course mean that once you restart the application all data is wiped clean.

####Model

The application manipulated a Company object. A company has the following attributes.

  • Company ID
  • Name
  • Address
  • City
  • Country
  • E­mail (Optional)
  • Phone Number (Optional)
  • One or more beneficial owner(s)

####Rest operations

The application allows 5 operations.

  1. Add a company. All the mandatory fields must be present for the request to succeed.
  • HTTP Method : POST
  • Rest URL : /company
  • cURL example using localhost: curl -H "Content-Type: application/json" -X POST -d '{"id":null,"name":"ISA","address":"175A, Greenpath","city":"Bambalapitiya","country":"Sri Lanka","email":"[email protected]","phoneNumber":"0094722262377","owners":["James Bond","Eric Foreman","Gregory House"]}' fierce-retreat-62806.herokuapp.com/company
  1. Edit a company. Only the properties that are present will be updated. Optional values however will be overriden to null of not present in the edit request. Owners attribute will be entirely replaced instead of being appended in this operation.
  • HTTP Method : PUT
  • Rest URL : /company/<company-id>
  • cURL example : curl -H "Content-Type: application/json" -X PUT -d '{"country":"Japan","email":"[email protected]","phoneNumber":"0094722262377"}' fierce-retreat-62806.herokuapp.com/company/1
  1. Add a owner to a company A new owner will be appended to the existing owner list in the company.
  • HTTP Method : PUT
  • Rest URL : /company/<company-id>/owner
  • cURL example using localhost: curl -H "Content-Type: application/json" -X PUT -d "Dean Winchester" fierce-retreat-62806.herokuapp.com/company/1/owner
  1. List a company. List company details for a given ID.
  • HTTP Method : GET
  • Rest URL : /company/<company-id>
  • cURL example using localhost: curl fierce-retreat-62806.herokuapp.com/company/1
  1. List all companies. Lists all the companies present in the application.
  • HTTP Method : GET
  • Rest URL : /company
  • cURL example using localhost: curl fierce-retreat-62806.herokuapp.com/company

##Client The client is written in Angular JS. It can be accessed from the /index.html or by simply visiting the applications root context /

rest-demo's People

Contributors

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