Hello and welcome to the Golang programming language course in this session.
We want to create a simple project based on which they created Server listens to the requests of the
BBC in response to it.
And we use Jason for a part of its implementation.
It's time to go to this school program to implement this project.
First, define the project name like Jason
now created Jason five for in-store port.
For the example, we named it config the Jason and set a server port inside its new five config the
JS.
First, create a key like server, port and set value for this key, for example, localhost column
885 save the conflict Jason Farnon close it so we could create a JSON file for, say, to report address.
Now create the folder, for example, named it web and create the file like micro that go inside it.
Create a folder like that and create a file like my actual wet set package.
In this case, we create a method called run that that listens to the server based on the received address.
This method is supposed to listen to Esta Typekit request so right from wrong where and set a variable
like addressed by the type estrange and address a string
to implement this function.
We use the handle font function of the H-2B package, so we write each TB dot handle performs this function.
Access to arguements first the string pattern and second a handler.
What what is handler?
A handler is an object implementing the Typekit handler interface.
A common way to write a handler is by using the Estep handler func adopter on functions with the appropriate
that signature functions serving as handlers.
Take it to the response writer and issue the prerequisite is arguements the response writer is used
to feel in the HDP response.
Now you want to write a handler function.
So go out of this function and define a new function for handler form.
For example, a root handler
set two variables for this.
First, the other new by the type be Dot's response writer.
And second, for the example, are by the time asterisk HDP dot request.
Now we want to display our IP, so we write f m t dot f print f.
First, it's an optic as writer, so we put that on you, and that's a message.
Welcome your IP is personal.
It's like a sledgehammer and sits remote areas from request by our Dot Remote Address Remote address
allows keep servers and other software to record the network address that send the request.
Now we could create a handler, so we should register it in handler font functions.
Now, go to handle Frank again and register our handlers on server roads.
Using the HTP Dot Handle Function Convenience function, it sets up the default rotor in the net HDTV
package and takes the function is an argument.
So go to the rainville and implement handler function.
This it is less at root and Sid Handler function put route handler.
Finally, we call the liaison and serve function from SD package with the port in Handler,
HDTV, Dot, Lisa and Serve Sit.
Address
and need.
Listen and serve function lessons on the TCP network address and then can't serve with Hamler to handle
requests on incoming connections.
This function accept two parameters.
First address in second handler the handlers, typically Neil and Neil, tells it to use the default
rotor.
We have just set up OK, we were able to implement a server part in order not to prolong the time decision.
We will finish it and we will continue the content in the next session.
Goodbye.