Bläddra i källkod

Update README.md

Git-Leon 7 år sedan
förälder
incheckning
ce4bdd0bc0
1 ändrade filer med 19 tillägg och 19 borttagningar
  1. 19
    19
      README.md

+ 19
- 19
README.md Visa fil

6
 
6
 
7
 
7
 
8
 -
8
 -
9
-# Part 1.1 - Create class `Option`
9
+## Part 1.1 - Create class `Option`
10
 * Create an `Option` class in the `domain` sub-package.
10
 * Create an `Option` class in the `domain` sub-package.
11
 * `Option` class signature is annotated with `@Entity`
11
 * `Option` class signature is annotated with `@Entity`
12
 * `Option` has an `id` instance variable of type `Long`
12
 * `Option` has an `id` instance variable of type `Long`
26
 
26
 
27
 
27
 
28
 -
28
 -
29
-# Part 1.2 - Create class `Poll`
29
+## Part 1.2 - Create class `Poll`
30
 * Create a `Poll` class in the `domain` sub-package.
30
 * Create a `Poll` class in the `domain` sub-package.
31
 * `Poll` class signature is annotated with `@Entity`
31
 * `Poll` class signature is annotated with `@Entity`
32
 * `Poll` has an `id` instance variable of type `Long`
32
 * `Poll` has an `id` instance variable of type `Long`
50
 
50
 
51
 
51
 
52
 -
52
 -
53
-# Part 1.3 - Create class `Vote`
53
+## Part 1.3 - Create class `Vote`
54
 * Create a `Vote` class in the `domain` sub-package.
54
 * Create a `Vote` class in the `domain` sub-package.
55
 * `Vote` class signature is annotated with `@Entity`
55
 * `Vote` class signature is annotated with `@Entity`
56
 * `Vote` has an `id` instance variable of type `Long`
56
 * `Vote` has an `id` instance variable of type `Long`
79
 
79
 
80
 
80
 
81
 -
81
 -
82
-# Part 2.1 - Create interface `OptionRepository`
82
+## Part 2.1 - Create interface `OptionRepository`
83
 * Create an `OptionRepository` interface in the `repositories` subpackage.
83
 * Create an `OptionRepository` interface in the `repositories` subpackage.
84
 * `OptionRepository` extends `CrudRepository<Option, Long>`
84
 * `OptionRepository` extends `CrudRepository<Option, Long>`
85
 
85
 
86
 -
86
 -
87
-# Part 2.2 - Create interface `PollRepository`
87
+## Part 2.2 - Create interface `PollRepository`
88
 * Create a `PollRepository` interface in the `repositories` subpackage.
88
 * Create a `PollRepository` interface in the `repositories` subpackage.
89
 * `PollRepository` extends `CrudRepository<Poll, Long>`
89
 * `PollRepository` extends `CrudRepository<Poll, Long>`
90
 
90
 
91
 -
91
 -
92
-# Part 2.3 - Create interface `VoteRepository`
92
+## Part 2.3 - Create interface `VoteRepository`
93
 * Create a `VoteRepository` interface in the `repositories` subpackage.
93
 * Create a `VoteRepository` interface in the `repositories` subpackage.
94
 * `VoteRepository` extends `CrudRepository<Vote, Long>`
94
 * `VoteRepository` extends `CrudRepository<Vote, Long>`
95
 
95
 
107
 
107
 
108
 
108
 
109
 -
109
 -
110
-# Part 3.1 - Create class `PollController`
110
+## Part 3.1 - Create class `PollController`
111
 * Create a `PollController` class in the `controller` sub package.
111
 * Create a `PollController` class in the `controller` sub package.
112
 	* `PollController` signature should be `annotated` with `@RestController`
112
 	* `PollController` signature should be `annotated` with `@RestController`
113
 
113
 
115
 	* `pollRepository` should be `annotated` with `@Inject`
115
 	* `pollRepository` should be `annotated` with `@Inject`
116
 
116
 
117
 -
117
 -
118
-# Part 3.1.1 - Create `GET` request method
118
+### Part 3.1.1 - Create `GET` request method
119
 * The method definition below supplies a `GET` request on the `/polls` endpoint which provides a collection of all of the polls available in the QuickPolls application. Copy and paste this into your `PollController` class.
119
 * The method definition below supplies a `GET` request on the `/polls` endpoint which provides a collection of all of the polls available in the QuickPolls application. Copy and paste this into your `PollController` class.
120
 
120
 
121
 ```java
121
 ```java
134
 
134
 
135
 
135
 
136
 -
136
 -
137
-# Part 3.1.2 - Testing via Postman
137
+### Part 3.1.2 - Testing via Postman
138
 * Ensure that the `start-class` tag in your `pom.xml` encapsulates `io.zipcoder.springdemo.QuickPollApplication`
138
 * Ensure that the `start-class` tag in your `pom.xml` encapsulates `io.zipcoder.springdemo.QuickPollApplication`
139
 * Open a command line and navigate to the project's root directory and run this command:
139
 * Open a command line and navigate to the project's root directory and run this command:
140
 	* `mvn spring-boot:run`
140
 	* `mvn spring-boot:run`
145
 
145
 
146
 
146
 
147
 -
147
 -
148
-# Part 3.1.3 - Create `POST` request method
148
+### Part 3.1.3 - Create `POST` request method
149
 * We accomplish the capability to add new polls to the `PollController` by implementing the `POST` verb functionality in a `createPoll` method:
149
 * We accomplish the capability to add new polls to the `PollController` by implementing the `POST` verb functionality in a `createPoll` method:
150
 
150
 
151
 ```java
151
 ```java
166
 
166
 
167
 
167
 
168
 -
168
 -
169
-# Part 3.1.4 - Modify `createPoll`
169
+### Part 3.1.4 - Modify `createPoll`
170
 * Best practice is to convey the URI to the newly created resource using the Location HTTP header via Spring's `ServletUriComponentsBuilder` utility class. This will ensure that the client has some way of knowing the URI of the newly created Poll.
170
 * Best practice is to convey the URI to the newly created resource using the Location HTTP header via Spring's `ServletUriComponentsBuilder` utility class. This will ensure that the client has some way of knowing the URI of the newly created Poll.
171
 
171
 
172
 ```java
172
 ```java
183
 
183
 
184
 
184
 
185
 -
185
 -
186
-# Part 3.1.5 - Create `GET` request method
186
+### Part 3.1.5 - Create `GET` request method
187
 * The code snippet below enables us to access an individual poll.
187
 * The code snippet below enables us to access an individual poll.
188
 * The _value attribute_ in the `@RequestMapping` takes a URI template `/polls/{pollId}`.
188
 * The _value attribute_ in the `@RequestMapping` takes a URI template `/polls/{pollId}`.
189
 * The placeholder `{pollId}` along with `@PathVarible` annotation allows Spring to examine the request URI path and extract the `pollId` parameter value.
189
 * The placeholder `{pollId}` along with `@PathVarible` annotation allows Spring to examine the request URI path and extract the `pollId` parameter value.
201
 
201
 
202
 
202
 
203
 -
203
 -
204
-# Part 3.1.6 - Create `UPDATE` request method
204
+### Part 3.1.6 - Create `UPDATE` request method
205
 * The code snippet below enables us to update a poll.
205
 * The code snippet below enables us to update a poll.
206
 
206
 
207
 ```java
207
 ```java
216
 
216
 
217
 
217
 
218
 -
218
 -
219
-# Part 3.1.7 - Create `DELETE` request method.
219
+### Part 3.1.7 - Create `DELETE` request method.
220
 
220
 
221
 * The code snippet below enables us to delete a poll.
221
 * The code snippet below enables us to delete a poll.
222
 
222
 
232
 
232
 
233
 
233
 
234
 -
234
 -
235
-# Part 3.1.8 - Test
235
+### Part 3.1.8 - Test
236
 * Restart the QuickPoll application.
236
 * Restart the QuickPoll application.
237
 * Use Postman to execute a `PUT` to `http://localhost:8080/polls/1` whose request body is the `JSON` object below.
237
 * Use Postman to execute a `PUT` to `http://localhost:8080/polls/1` whose request body is the `JSON` object below.
238
 * You can modify the request body in Postman by navigating to the `Body` tab, selecting the `raw` radio button, and selecting the `JSON` option from the text format dropdown.
238
 * You can modify the request body in Postman by navigating to the `Body` tab, selecting the `raw` radio button, and selecting the `JSON` option from the text format dropdown.
252
 
252
 
253
 
253
 
254
 -
254
 -
255
-# Part 3.2 - Create class `VoteController`
255
+## Part 3.2 - Create class `VoteController`
256
 * Following the principles used to create `PollController`, we implement the `VoteController` class.
256
 * Following the principles used to create `PollController`, we implement the `VoteController` class.
257
 * Below is the code for the `VoteController` class along with the functionality to create a vote.
257
 * Below is the code for the `VoteController` class along with the functionality to create a vote.
258
 * The `VoteController` uses an injected instance of `VoteRepository` to perform `CRUD` operations on Vote instances.
258
 * The `VoteController` uses an injected instance of `VoteRepository` to perform `CRUD` operations on Vote instances.
276
 }
276
 }
277
 ```
277
 ```
278
 
278
 
279
-# Part 3.2.1 - Testing `VoteController`
279
+### Part 3.2.1 - Testing `VoteController`
280
 * To test the voting capabilities, `POST` a new Vote to the `/polls/1/votes` endpoint with the option object expressed in `JSON` below.
280
 * To test the voting capabilities, `POST` a new Vote to the `/polls/1/votes` endpoint with the option object expressed in `JSON` below.
281
 * On successful request execution, you will see a Location response header with value http://localhost:8080/polls/1/votes/1.
281
 * On successful request execution, you will see a Location response header with value http://localhost:8080/polls/1/votes/1.
282
 
282
 
290
 
290
 
291
 
291
 
292
 -
292
 -
293
-# Part 3.2.2 - Modify `VoteRepository`
293
+### Part 3.2.2 - Modify `VoteRepository`
294
 * The method `findAll` in the `VoteRepository` retrieves all votes in a Database rather than a given poll.
294
 * The method `findAll` in the `VoteRepository` retrieves all votes in a Database rather than a given poll.
295
 * To ensure we can get votes for a given poll, we must add the code below to our `VoteRepository`.
295
 * To ensure we can get votes for a given poll, we must add the code below to our `VoteRepository`.
296
 
296
 
311
 
311
 
312
 
312
 
313
 -
313
 -
314
-# Part 3.2.3 - Modify `VoteController`
314
+### Part 3.2.3 - Modify `VoteController`
315
 * Create a `getAllVotes` method in the `VoteController`
315
 * Create a `getAllVotes` method in the `VoteController`
316
 
316
 
317
 
317