Fix grammar and typos for 03.2.md
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# 3.2 Build a simple web server
|
||||
|
||||
We talked about that web applications are based on HTTP protocol, and Go provides fully ability for HTTP in package `net/http`, it's very easy to setup a web server by using this package.
|
||||
We've discussed that web applications are based on the HTTP protocol, and Go provides full HTTP support in the `net/http` package. It's very easy to set a web server up using this package.
|
||||
|
||||
## Use http package setup a web server
|
||||
|
||||
@@ -34,32 +34,32 @@ We talked about that web applications are based on HTTP protocol, and Go provide
|
||||
}
|
||||
}
|
||||
|
||||
After we executed above code, it starts listening to port 9090 in local host.
|
||||
After we execute the above code, the server begins listening to port 9090 in local host.
|
||||
|
||||
Open your browser and visit `http://localhost:9090`, you can see that `Hello astaxie` is on your screen.
|
||||
Open your browser and visit `http://localhost:9090`. You can see that `Hello astaxie` is on your screen.
|
||||
|
||||
Let's try another address with arguments: `http://localhost:9090/?url_long=111&url_long=222`
|
||||
Let's try another address with additional arguments: `http://localhost:9090/?url_long=111&url_long=222`
|
||||
|
||||
Now see what happened in both client and server sides.
|
||||
Now let's see what happens on both the client and server sides.
|
||||
|
||||
You should see following information in your server side:
|
||||
You should see the following information on the server side:
|
||||
|
||||

|
||||
|
||||
Figure 3.8 Server printed information
|
||||
|
||||
As you can see, we only need to call two functions to build a simple web server.
|
||||
As you can see, we only need to call two functions in order to build a simple web server.
|
||||
|
||||
If you are working with PHP, you probably want to ask do we need something like Nginx or Apache, the answer is we don't need because Go listens to TCP port by itself, and the function `sayhelloName` is the logic function like controller in PHP.
|
||||
If you are working with PHP, you're probably asking whether or not we need something like Nginx or Apache. The answer is we no, since Go listens to the TCP port by itself, and the function `sayhelloName` is the logic function just like a controller in PHP.
|
||||
|
||||
If you are working with Python, you should know tornado, and the above example is very similar to that.
|
||||
If you are working with Python you should know tornado, and the above example is very similar to that.
|
||||
|
||||
If you are working with Ruby, you may notice it is like script/server in ROR.
|
||||
|
||||
We use two simple functions to setup a simple web server in this section, and this simple server has already had ability for high concurrency. We will talk about how to use this feature in next two sections.
|
||||
We used two simple functions to setup a simple web server in this section, and this simple server already has the capacity for high concurrency operations. We will talk about how to utilize this in the next two sections.
|
||||
|
||||
## Links
|
||||
|
||||
- [Directory](preface.md)
|
||||
- Previous section: [Web working principles](03.1.md)
|
||||
- Next section: [How Go works with web](03.3.md)
|
||||
- Next section: [How Go works with web](03.3.md)
|
||||
|
||||
Reference in New Issue
Block a user