Skip to content

albanoj2/order-rest-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Order Management REST API CI Status

Demonstrates a simple RESTful web service using Spring MVC and Java. This web service provides an in-memory order management service, with the capability to get a single order, get all orders, create an order, delete an order, and update an order. After exploring this project, the reader will understand the three common layers of a RESTful web service (namely domain, data source, and presentation), the common design decisions used when creating a web service, and the functionality provided by the Spring framework for creating a web service (as well as supplemental functionality, such as creating HATEOAS links). In particular, the reader will learn

  • How to create a domain model
  • How to store domain objects in a persistence layer
  • How to wrap domain objects within resource objects
  • How to add HATEOAS links to a resource
  • How to serve up resources to a client over HTTP
  • How to provide RESTful Create, Read, Update, and Delete (CRUD) operations to change domain objects
  • How to create unit, integration, and acceptance tests that exercise a REST API

Starting the Order Management System

To start this web service, install Maven and execute the following command

mvn spring-boot:run

Once the web service is started, it can be reached at

http://localhost:8080/order

REST Endpoints

The following REST endpoints are available upon deployment of the order management system:

HTTP Verb URL Description Status Codes
GET http://localhost:8080/order Obtains a list of all existing orders
  • 200 OK
GET http://localhost:8080/order/{id} Obtains the order corresponding to the supplied order ID
  • 200 OK if order exists
  • 404 Not Found if order does not exist
POST http://localhost:8080/order Creates a new order based on the payload contained in the request body
  • 201 Created if order successfully created
PUT http://localhost:8080/order/{id} Updated an existing order with the data contained in the request body
  • 200 OK if order succesfully updated
  • 404 Not Found if order does not exist
DELETE http://localhost:8080/order/{id} Deletes an existing order that corresponds to the supplied order ID
  • 204 No Content if order succesfully deleted
  • 404 Not Found if order does not exist

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published