https://github.com/dcoxall/dropwizard-demo
https://github.com/dcoxall/dropwizard-demo
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/dcoxall/dropwizard-demo
- Owner: dcoxall
- License: mit
- Created: 2016-02-25T16:39:50.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-26T11:53:42.000Z (over 10 years ago)
- Last Synced: 2025-01-15T01:03:28.618Z (over 1 year ago)
- Language: Java
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dropwizard Demo
This repo serves as a very basic example of a Dropwizard application.
The API represents a very very basic Product model.
cat | http put :8080/products/1
{
"name": "Product Name",
"description": "My product description",
"stock": 123,
"currency_code": "GBP",
"price": 123.45
}
HTTP/1.1 204 No Content
Date: Thu, 25 Feb 2016 16:52:31 GMT
Location: http://localhost:8080/products/1
http get :8080/products/1
HTTP/1.1 200 OK
Content-Length: 165
Content-Type: application/json
Date: Thu, 25 Feb 2016 16:53:29 GMT
{
"currency_code": "GBP",
"description": "My product description",
"display": {
"in_stock": true,
"price": "£123.45"
},
"id": 1,
"name": "Product Name",
"price": 123.45,
"stock": 123
}
http get :8080/products
HTTP/1.1 200 OK
Content-Encoding: gzip
Content-Length: 152
Content-Type: application/json
Date: Thu, 25 Feb 2016 16:54:56 GMT
Vary: Accept-Encoding
[
{
"currency_code": "GBP",
"description": "My product description",
"display": {
"in_stock": true,
"price": "£123.45"
},
"id": 1,
"name": "Product Name",
"price": 123.45,
"stock": 123
},
{
"currency_code": "GBP",
"description": "My product description",
"display": {
"in_stock": true,
"price": "£123.45"
},
"id": 2,
"name": "Product Name",
"price": 123.45,
"stock": 123
}
]
http delete :8080/products/1
HTTP/1.1 200 OK
Content-Length: 0
Date: Thu, 25 Feb 2016 16:55:26 GMT
## Usage
mvn package
java -jar target/productdemo-1.0-SNAPSHOT.jar server config.yml
## Noteworthy Features
- Custom health checks
- Application lifecycle hooks
- Simple (de)serialization
- Code over configuration