Hello and welcome to the golden programming language course in the pit of your session.
We were able to implement a server part and in this session, we want to go to main function and use
from created server.
OK, now go to Project Explorer and create a main file.
You mean the go set package main and define main function.
But before main function, first we create an equivalent extract for the JS on file created at the beginning
of the project so that we can map that JSON file to the Golang equivalent data.
So the right time
configuration is to define a variable like server port by the time a string and set JSON tak
jason color.
Server for
now, go to the main function and open JSON file by the open function from OS package
first defined to variable file and call an equal and calling open function from worse package and set
config dot JSON file an argument for it.
Config dot js open function opens the named fine for reading if successful methods on the return file
can be used for reading.
If there is an error, it will be of type Astrid's pass or now we check error status.
If error, you like the fatal error that.
Yeah.
Now we create an object from configuration, obstruct, define a variable like con calling equals new
configuration.
From Jason Package, the call new decoder and Sid Fine as arguments to it then called function insists
common variable as empty in their face value, but first define a variable like error equals Jason Dodd's
new decoder set.
Fire this argument and call decode and Sid confess argument for it.
In this case, the good function reads the next JSON encoded value from its input and installs it in
the value pointer to buy conf now check error status.
If error like that fatal error darts error.
Now call drums that metal from the VVIP package and pass the port silver value to it as an argument
before calling Fonctionnent first set a message FP wrong, sir.
Now cutting function with dart from there and sit set report as arguments to it by the carve object.
Reformat the court, save the project and execute the program, see the Jason
go wrong.
Dot backslash.
That's cool.
OK, now we can see server is running in this time we go to browser and enter defined address in JSON
file and we will see the server response go to the browser, enter a defined address in JSON.
Find in browser you are at low quarter past column 885 and press enter.
OK.
We can see the server response.
We could create a single server and send requests to it.
And for this purpose, we use Jason Phi and they got into coding data.
And in this project, we could use from JSON implementation.
We have reached the end of this session.
I hope you have taken full advantage of decision until next session.
Good bye.