ソースを参照

Update README to use code fencing

Roy Clarkson 13 年 前
コミット
d01a59dcba
共有2 個のファイルを変更した42 個の追加19 個の削除を含む
  1. 18
    8
      README.ftl.md
  2. 24
    11
      README.md

+ 18
- 8
README.ftl.md ファイルの表示

@@ -11,7 +11,9 @@ This guide walks you through creating a "hello world" [RESTful web service][u-re
11 11
 
12 12
 and respond with a [JSON][u-json] representation of a greeting:
13 13
 
14
-    {"id":1,"content":"Hello, World!"}
14
+```json
15
+{"id":1,"content":"Hello, World!"}
16
+```
15 17
 
16 18
 You can customize the greeting with an optional `name` parameter in the query string:
17 19
 
@@ -19,7 +21,9 @@ You can customize the greeting with an optional `name` parameter in the query st
19 21
 
20 22
 The `name` parameter value overrides the default value of "World" and is reflected in the response:
21 23
 
22
-    {"id":1,"content":"Hello, User!"}
24
+```json
25
+{"id":1,"content":"Hello, User!"}
26
+```
23 27
 
24 28
 
25 29
 What you'll need
@@ -57,10 +61,12 @@ Begin the process by thinking about service interactions.
57 61
 
58 62
 The service will handle `GET` requests for `/greeting`, optionally with a `name` parameter in the query string. The `GET` request should return a `200 OK` response with JSON in the body that represents a greeting. It should look something like this:
59 63
 
60
-    {
61
-        "id": 1,
62
-        "content": "Hello, World!"
63
-    }
64
+```json
65
+{
66
+    "id": 1,
67
+    "content": "Hello, World!"
68
+}
69
+```
64 70
 
65 71
 The `id` field is a unique identifier for the greeting, and `content` is the textual representation of the greeting.
66 72
 
@@ -126,11 +132,15 @@ Test the service
126 132
 
127 133
 Now that the service is up, visit <http://localhost:8080/greeting>, where you see:
128 134
 
129
-    {"id":1,"content":"Hello, World!"}
135
+```json
136
+{"id":1,"content":"Hello, World!"}
137
+```
130 138
 
131 139
 Provide a `name` query string parameter with <http://localhost:8080/greeting?name=User>. Notice how the value of the `content` attribute changes from "Hello, World!" to "Hello User!":
132 140
 
133
-    {"id":2,"content":"Hello, User!"}
141
+```json
142
+{"id":2,"content":"Hello, User!"}
143
+```
134 144
 
135 145
 This change demonstrates that the `@RequestParam` arrangement in `GreetingController` is working as expected. The `name` parameter has been given a default value of "World", but can always be explicitly overridden through the query string.
136 146
 

+ 24
- 11
README.md ファイルの表示

@@ -10,7 +10,9 @@ This guide walks you through creating a "hello world" [RESTful web service][u-re
10 10
 
11 11
 and respond with a [JSON][u-json] representation of a greeting:
12 12
 
13
-    {"id":1,"content":"Hello, World!"}
13
+```json
14
+{"id":1,"content":"Hello, World!"}
15
+```
14 16
 
15 17
 You can customize the greeting with an optional `name` parameter in the query string:
16 18
 
@@ -18,7 +20,9 @@ You can customize the greeting with an optional `name` parameter in the query st
18 20
 
19 21
 The `name` parameter value overrides the default value of "World" and is reflected in the response:
20 22
 
21
-    {"id":1,"content":"Hello, User!"}
23
+```json
24
+{"id":1,"content":"Hello, User!"}
25
+```
22 26
 
23 27
 
24 28
 What you'll need
@@ -129,10 +133,12 @@ Begin the process by thinking about service interactions.
129 133
 
130 134
 The service will handle `GET` requests for `/greeting`, optionally with a `name` parameter in the query string. The `GET` request should return a `200 OK` response with JSON in the body that represents a greeting. It should look something like this:
131 135
 
132
-    {
133
-        "id": 1,
134
-        "content": "Hello, World!"
135
-    }
136
+```json
137
+{
138
+    "id": 1,
139
+    "content": "Hello, World!"
140
+}
141
+```
136 142
 
137 143
 The `id` field is a unique identifier for the greeting, and `content` is the textual representation of the greeting.
138 144
 
@@ -273,7 +279,9 @@ The [Spring Package maven plugin][spring-package-maven-plugin] collects all the
273 279
 
274 280
 Now run the following to produce a single executable JAR file containing all necessary dependency classes and resources:
275 281
 
276
-    mvn package
282
+```sh
283
+$ mvn package
284
+```
277 285
 
278 286
 [spring-package-maven-plugin]: https://github.com/SpringSource/spring-zero/tree/master/spring-package-maven-plugin
279 287
 
@@ -283,8 +291,9 @@ Run the service
283 291
 -------------------
284 292
 Run your service with `java -jar` at the command line:
285 293
 
286
-    java -jar target/gs-rest-service-0.1.0.jar
287
-
294
+```sh
295
+$ java -jar target/gs-rest-service-0.1.0.jar
296
+```
288 297
 
289 298
 
290 299
 Logging output is displayed. The service should be up and running within a few seconds.
@@ -295,11 +304,15 @@ Test the service
295 304
 
296 305
 Now that the service is up, visit <http://localhost:8080/greeting>, where you see:
297 306
 
298
-    {"id":1,"content":"Hello, World!"}
307
+```json
308
+{"id":1,"content":"Hello, World!"}
309
+```
299 310
 
300 311
 Provide a `name` query string parameter with <http://localhost:8080/greeting?name=User>. Notice how the value of the `content` attribute changes from "Hello, World!" to "Hello User!":
301 312
 
302
-    {"id":2,"content":"Hello, User!"}
313
+```json
314
+{"id":2,"content":"Hello, User!"}
315
+```
303 316
 
304 317
 This change demonstrates that the `@RequestParam` arrangement in `GreetingController` is working as expected. The `name` parameter has been given a default value of "World", but can always be explicitly overridden through the query string.
305 318