This is an automated email from the ASF dual-hosted git repository. fanningpj pushed a commit to branch wip-adding-tests in repository https://gitbox.apache.org/repos/asf/incubator-pekko-http-quickstart-scala-g8.git
commit 86a31e1e429f4ed6814e12025e6636771a145544 Author: henrikengstrom <[email protected]> AuthorDate: Thu Jul 6 15:43:19 2017 -0400 Misc fixes based on PR comments. --- docs/src/main/paradox/backend.md | 2 +- docs/src/main/paradox/index.md | 10 +++++----- docs/src/main/paradox/intellij-idea.md | 4 ++-- docs/src/main/paradox/json.md | 2 +- docs/src/main/paradox/running-the-application.md | 4 ++-- docs/src/main/paradox/server-class.md | 14 +++++++------- project/paradox.sbt | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/src/main/paradox/backend.md b/docs/src/main/paradox/backend.md index d14110e..8de403b 100644 --- a/docs/src/main/paradox/backend.md +++ b/docs/src/main/paradox/backend.md @@ -1,7 +1,7 @@ Backend ------- -It is probably an exaggeration to call this for a "backend" since it, in this sample, only consists of a basic actor. In a real system, we would have many actors interacting with each other and perhaps a database or microservices. However, since the focus of this tutorial is on Akka Http, it is not very important what this backend does but more how to interact with a backend from within Akka Http. Hopefully, you already have a good grasp of how to communicate back and forth between Akka [...] +It is probably an exaggeration to call this for a "backend" since it, in this sample, only consists of a basic actor. In a real system, we would have many actors interacting with each other and perhaps a database or microservices. However, since the focus of this tutorial is on Akka HTTP, it is not very important what this backend does but more how to interact with a backend from within Akka HTTP. Hopefully, you already have a good grasp of how to communicate back and forth between Akka [...] If you feel you should brush up your Akka Actor knowledge, then the [getting started guide]((http://developer.lightbend.com/guides/akka-quickstart-scala/)) for Akka actors tutorial is a good start. diff --git a/docs/src/main/paradox/index.md b/docs/src/main/paradox/index.md index 8b8cab6..72b554a 100644 --- a/docs/src/main/paradox/index.md +++ b/docs/src/main/paradox/index.md @@ -1,4 +1,4 @@ -Akka Http Quickstart with Scala +Akka HTTP Quickstart with Scala =============================== The Akka HTTP modules implement a full server- and client-side HTTP stack on top of akka-actor and akka-stream. It’s not a web-framework but rather a more general toolkit for providing and consuming HTTP-based services. While interaction with a browser is of course also in scope, it is not the primary focus of Akka HTTP. @@ -9,7 +9,7 @@ This Hello World example demonstrates some Akka HTTP fundamentals. Within 30 min ## Prerequisite -Having a basic understanding of Akka actors will help the reader of this guide. There is a [getting started guide]((http://developer.lightbend.com/guides/akka-quickstart-scala/)) for Akka actors in if you feel like brushing up your knowledge thereof. +Having a basic understanding of Akka actors will help the reader of this guide. There is a [getting started guide](https://developer.lightbend.com/guides/akka-quickstart-scala/) for Akka actors should you feel like brushing up your knowledge thereof. ## Downloading the example @@ -20,7 +20,7 @@ Download and unzip the example: 1. Download the zip file from Lightbend Tech Hub by clicking `CREATE A PROJECT FOR ME`. 2. Extract the zip file to a convenient location: -* On Linux and OSX systems, open a terminal and use the command unzip akka-quickstart-scala.zip. Note: On OSX, if you unzip using Archiver, you also have to make the sbt files executable: +* On Linux and MacOS systems, open a terminal and use the command `unzip` akka-quickstart-scala.zip. Note: On OSX, if you unzip using Archiver, you also have to make the sbt files executable: ``` $ chmod u+x ./sbt @@ -55,9 +55,9 @@ Server online at http://localhost:8080/ Press RETURN to stop... ``` -The command above will start an Akka Http server. We will look at how to invoke the available endpoints of the server later in this guide. +The command above will start an Akka HTTP server. We will look at how to invoke the available endpoints of the server later in this guide. -Congratulations, you just ran your first Akka Http app. Now take a look at what happened under the covers. +Congratulations, you just ran your first Akka HTTP app. Now take a look at what happened under the covers. ## What Hello World does diff --git a/docs/src/main/paradox/intellij-idea.md b/docs/src/main/paradox/intellij-idea.md index 7aaeb71..f55a8ad 100644 --- a/docs/src/main/paradox/intellij-idea.md +++ b/docs/src/main/paradox/intellij-idea.md @@ -1,7 +1,7 @@ IntelliJ IDEA ------------- -[IntelliJ](https://www.jetbrains.com/idea/) from JetBrains is one of the leading IDEs in the Java/Scala community, and it has excellent support for Akka Http. This section will guide you through setting up, testing and running the sample project. +[IntelliJ](https://www.jetbrains.com/idea/) from JetBrains is one of the leading IDEs in the Java/Scala community, and it has excellent support for Akka HTTP. This section will guide you through setting up, testing and running the sample project. ## Setting up the project @@ -23,4 +23,4 @@ Right click on the file `src/main/scala/com/lightbend/akka/http/sample/Quickstar ## Tutorial done! -Congratulations! We have now learned enough concepts to get started with building real-world Akka Http applications. Of course, there is plenty of more that we can do with Akka Http and the [documentation](http://doc.akka.io/docs/akka-http/current/scala/http/index.html) is a good starting point if there is something more you need. +Congratulations! We have now learned enough concepts to get started with building real-world Akka HTTP applications. Of course, there is plenty of more that we can do with Akka HTTP and the [documentation](http://doc.akka.io/docs/akka-http/current/scala/http/index.html) is a good starting point if there is something more you need. diff --git a/docs/src/main/paradox/json.md b/docs/src/main/paradox/json.md index bf91eab..06e09a8 100644 --- a/docs/src/main/paradox/json.md +++ b/docs/src/main/paradox/json.md @@ -11,7 +11,7 @@ See the `JsonSupport` up there? This is a trait that we have created and it look @@snip [JsonSupport.scala]($g8src$/scala/com/lightbend/akka/http/sample/JsonSupport.scala) -The above trait defines two implicit values; `userJsonFormat` and `usersJsonFormat`. To do so we use the `jsonFormatX` methods, from [Spray Json](), where X is representing the number of parameters in the underlying case classes: +The above trait defines two implicit values; `userJsonFormat` and `usersJsonFormat`. To do so we use the `jsonFormatX` methods, from [Spray Json](https://github.com/spray/spray-json), where X is representing the number of parameters in the underlying case classes: @@snip [UserRegistryActor.scala]($g8src$/scala/com/lightbend/akka/http/sample/UserRegistryActor.scala) { #user-case-classes } diff --git a/docs/src/main/paradox/running-the-application.md b/docs/src/main/paradox/running-the-application.md index 6dafe7c..ac9d6d1 100644 --- a/docs/src/main/paradox/running-the-application.md +++ b/docs/src/main/paradox/running-the-application.md @@ -30,7 +30,7 @@ Press RETURN to stop... ## Testing the application -The Akka Http server is now running, and we will use the [cURL](https://en.wikipedia.org/wiki/CURL) command to test the application. If you should prefer to use your browser to test the service than a tool like [RESTClient](http://restclient.net/) may be good to install. +The Akka HTTP server is now running, and we will use the [cURL](https://en.wikipedia.org/wiki/CURL) command to test the application. If you prefer to use your browser to test the service then a tool like [RESTClient](http://restclient.net/) may be good to install. Open another console/terminal window to investigate the functionality of the application. @@ -53,7 +53,7 @@ $ curl -H "Content-type: application/json" -X POST -d '{"name": "Bill", "age": 6 User Bill created. ``` -We can try to retrieve user information for some various users now: +We can try to retrieve user information for various users now: ``` $ curl http://localhost:8080/user/MrX diff --git a/docs/src/main/paradox/server-class.md b/docs/src/main/paradox/server-class.md index 45e4782..c10f9ad 100644 --- a/docs/src/main/paradox/server-class.md +++ b/docs/src/main/paradox/server-class.md @@ -5,7 +5,7 @@ Let's dissect the main class, `QuickstartServer`. We make this class runnable by @@snip [QuickstartServer.scala]($g8src$/scala/com/lightbend/akka/http/sample/QuickstartServer.scala) { #main-class } -Now that we have a class to run we should add some Akka Http fundamentals with which we will build our RESTful web service: +Now that we have a class to run we should add some Akka HTTP fundamentals with which we will build our RESTful web service: * define routes bound to endpoints and HTTP directives * create a server bound to an IP and port that will handle all requests @@ -24,7 +24,7 @@ For our service we want to define the following endpoints: | /user/$ID | DELETE | Remove a user | Confirmation message | | /users | GET | Retrieve all users | JSON payload | -Akka Http provides a [domain-specific language](https://en.wikipedia.org/wiki/Domain-specific_language) (DSL) to simplify the routes/endpoints definition. Each route is composed of one or more `akka.http.scaladsl.server.Directives`, e.g. `path`, `get`, `post`, `complete`, etc. +Akka HTTP provides a [domain-specific language](https://en.wikipedia.org/wiki/Domain-specific_language) (DSL) to simplify the routes/endpoints definition. Each route is composed of one or more `akka.http.scaladsl.server.Directives`, e.g. `path`, `get`, `post`, `complete`, etc. ### Creating a new user @@ -63,7 +63,7 @@ The remaining directives used for this route are: * `~` : fuses `Route`s together - this will become more apparent when you see the complete `Route` definition here below. * `delete` : matches against the Http directive `DELETE`. -The "business logic" for when deleting a user is straight forward; send an instruction about removing a user to the user registry actor and return a status code to the client (which in this case is `StatusCodes.OK`, i.e. Http 200) +The "business logic" for when deleting a user is straight forward; send an instruction about removing a user to the user registry actor and return a status code to the client (which in this case is `StatusCodes.OK`, i.e. Http status code 200) ### Retrieving all users @@ -81,11 +81,11 @@ Below is the complete `Route` definition used in the sample application: @@snip [QuickstartServer.scala]($g8src$/scala/com/lightbend/akka/http/sample/QuickstartServer.scala) { #all-routes } -So far we have referred to `Route` without explaining what it is but now is the time to do so. Under the hood, Akka Http uses [Akka Streams](http://doc.akka.io/docs/akka/current/scala/stream/index.html). We don't have time to cover Akka Streams here, but if you are interested, you should take a look at the Hello World sample application for Streams. Since Akka Http is built on top of Akka Streams, it means that some concepts of Streams are available for us to use. In the case of `Route` [...] +So far we have referred to `Route` without explaining what it is but now is the time to do so. Under the hood, Akka HTTP uses [Akka Streams](http://doc.akka.io/docs/akka/current/scala/stream/index.html). We don't have time to cover Akka Streams here, but if you are interested, you should take a look at the Hello World sample application for Akka Streams. Since Akka HTTP is built on top of Akka Streams, it means that some concepts of Akka Streams are available for us to use. In the case o [...] ## Http server -To set up an Akka Http server we must first define some implicit values that will be used by the server: +To set up an Akka HTTP server we must first define some implicit values that will be used by the server: @@snip [QuickstartServer.scala]($g8src$/scala/com/lightbend/akka/http/sample/QuickstartServer.scala) { #server-bootstrapping } @@ -98,7 +98,7 @@ With that defined we can move on to instantiate the server: @@snip [QuickstartServer.scala]($g8src$/scala/com/lightbend/akka/http/sample/QuickstartServer.scala) { #http-server } -We provide three parameters; `routes`, the hostname, and the port. That's it! When running this program, we will have an Akka Http server on our machine (localhost) on port 8080. Note that starting a server happens asynchronously and therefore a `Future` is returned by the `bindAndHandle` method. +We provide three parameters; `routes`, the hostname, and the port. That's it! When running this program, we will have an Akka HTTP server on our machine (localhost) on port 8080. Note that starting a server happens asynchronously and therefore a `Future` is returned by the `bindAndHandle` method. We should also add code for stopping the server. To do so we use the `StdIn.readLine()` method that will wait until RETURN is pressed on the keyboard. When that happens we `flatMap` the `Future` returned when we started the server to get to the `unbind()` method. Unbinding is also an asynchronous function and when the `Future` returned by `unbind()` is completes we make sure that the actor system is properly terminated. @@ -106,7 +106,7 @@ We should also add code for stopping the server. To do so we use the `StdIn.read Finally, we should take a look at how to handle errors. We know, as the astute engineers we are, that errors will happen. We should prepare our program for this and error handling should not be an afterthought when we build systems. -In this sample, we use a very simple exception handler which catches all unexpected exceptions and responds back to the client with an `InternalServerError` (HTTP 500) with an error message and for what URI the exception happened. We extract the URI by using the `extractUri` directive. +In this sample, we use a very simple exception handler which catches all unexpected exceptions and responds back to the client with an `InternalServerError` (HTTP status code 500) with an error message and for what URI the exception happened. We extract the URI by using the `extractUri` directive. @@snip [QuickstartServer.scala]($g8src$/scala/com/lightbend/akka/http/sample/QuickstartServer.scala) { #exception-handler } diff --git a/project/paradox.sbt b/project/paradox.sbt index 01bcc5c..e69316a 100644 --- a/project/paradox.sbt +++ b/project/paradox.sbt @@ -1,2 +1,2 @@ // sbt-paradox, used for documentation -addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.2.11") +addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.2.12") --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
