Hello and welcome to the goal and programming language course in the penalty session.
We were able to implement the rest functions and now it's time to implement the configurations related
to rest API.
So go to Project Folder and go to rest layer and create a go link file named like risk config.
So go to rest layer.
Create a new file like rest config,
first package name package rest layer.
First, we create and implements a method that is responsible for create different reporters to respond
to different U R L requests or end points.
So create a method name like race feek, this function ads that are water objects from Musk's package
as input parameter.
So we right find.
Rest, calm feet
and sit rotor as parameter from pole to love locks
rotor.
Relata registers roads to be matched and dispatches the handler, it implements the ITBP handler interface
so it can be registered to serve requests.
Now we want to define an end point as per fix or a fixed value that exists in all and points for rest.
So from the rotor object, we call the get perfect method and set our fixed end point in it.
So first, define the variable light rare throughout our wrist.
Lauter call it equals from rotor object calling pass per fix function, rotor dart pass per fix function.
For example, we said it's less risk if this API, as fixed endpoint in all requests sits, is less
rest.
This last API and then calling SOP rotor function dot sop rotor stop rotor function creates a somber
rotor for the road.
It will test the inner roads only if the parents route matched, so we were able to define a common
end point as a perfect for our requests.
Now we want to create different endpoints.
Suppose we want to return all the students of this student table from person database by calling in
and point of view on it.
To do this, we do the following current methods function from the created resource rotor for set type
of requests, methods, function registers and new role within a matter for ESTEP methods.
In this case, we want to use yet requested sore right
wrist rotor.
Net methods.
And so it gets as a request site and calling pass function, pat function.
That's a matter for the U.S. to pat it, accept a template with zero or more.
You are all variables enclosed by credit braces.
The template must start with the restless and variable names must be unique in a given route.
In this case for which all the students we set that Pat's like as a student, so we write Dot.
And since it's less students.
And then calling handler function dog handler function, this function sets a handler function for the.
Now we need to give a function handler as a parameter to dismantle and see what is going to do for us.
Now, Paul's a functional handler from a rest function, fine as arguments in this case.
We want to focus on students, so be in books, select all students function, select all students function.
So we were able to create an end point to fetch all the students from a student table of the person
database.
Now we create another employee to first a student based name from the database to do this.
We do the following culling methods function from the created wrist rotor faucet type of request wrist
rotor dots methods
type of the request in these cases get sit packed
in this case for a student base its name.
Set apart like SLAC student slash caliber SS and set the name name variable as parameter.
So the right list student slash curly braces sit a variable ask parameter, for example.
In this case, we sit name.
And calling handler function.
In this case, we want to fit a student base its name solving would select a student based name function
as handler function, select a student base name.
So we were able to create a named point to fit a student base its name from a student table of the person
database.
Now create another end point, for example, to seven new student into person database, so go to the
next line calling method function from restful to this role to what methods?
In this case, we want to use post as requested and calling pant function.
So we write post as request type and calling pad function.
We want to insert a new Sudan.
So we said the part like that special student, a class act.
It's less student.
It's less act and cutting handle the function.
We need to give a function handed as a parameter.
In this case, we want to save a new student so we can save a student function, save the student function.
So we were able to create an endpoint to save in the student.
And now we want to create another endpoint to update existing student into a person database.
So calling methods function from this role to their slaughter.
NATO's function
and in this case, we use from post as a request type post calling pad function.
We want to update in New Sudan, so we said that Pat Riley is such a student, this last edit is less
students, is less headed and invoke have their function.
In this case, we want to update annexes to Sudan, so we won't update is to then function from rest
functions, update students, OK, the format, the code and save the project.
Now we were able to implement the rest config methods to create different rotors like save, update
and select.
In order not to prolong the time of decision, we will finish it and we will continue to contend in
the next session.
Goodbye.