Skip to content

Instantly share code, notes, and snippets.

@ahatzz11
Last active August 20, 2019 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahatzz11/23ef9ee99bf755d1f16631bdbddc5fea to your computer and use it in GitHub Desktop.
Save ahatzz11/23ef9ee99bf755d1f16631bdbddc5fea to your computer and use it in GitHub Desktop.
Use the latest version of all existing tech
Technology:
- Groovy as the language // don't use 3.x, it's beta still
- Springboot as the framework
- Gradle for building
Business Requirements:
Create an API that takes manages products.
- Can create object
- Can get object
Technical Requirements:
- one controller `com.x.y.appname.controller.ProductController` to handle api requests.
- one service to handle the products - `com.x.y.appname.service.ProductService`
- one model for a product - `com.x.y.appname.model.Product`
- for now you don't need to have a database, just get something you can make a request to and it can serve hard coded data
example json:
```
{
"id": "something",
"name": "Super Soaker 3000",
"price": 50.00,
"inventory": 100
}
```
controller endpoints:
```
to get the product with an identifier of 123:
GET /products/123
to make a new product:
POST /products with the above json as the request body
```
Requirements:
- run `./gradlew clean build` to run a build of the app
- run `./gradlew bootRun` to run the app
- send the above example requests and have things work
resources:
this will be your best starting point: https://start.spring.io/ (choose gradle, groovy, springboot 2.1.7)
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/
almost anything spring related you google will have a result from https://www.baeldung.com
https://www.baeldung.com/spring-boot-start (note, his example uses maven. you should use gradle!
- on this you can skip sections 4, 5, and 6, 8, and 9. we'll do some of this later
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment