Node
Node
->
=>restful services=>
also known as restful APIs.
> a http request is made to make any changes in the courses end point.
>every http request is known as`method ` and that decides its intention.
>standard http methods are [GET POST PUT DELETE ]
>GET==
to receive the list of courses available in the app we use GET method.
if we write the idea or index of the course in the domain like
GET/api/courses/math OR GET/api/courses/05
then we can get the exact value of that index
syntax:-- GET/api/courses
>PUT==
to update a courses we have to send http put request to the endpoint.
also we have to enter the updated proporty of the object and send it to the server.
server will update the requirement values.
syntax:-- PUT/api/courses
>DELETE==
to delete a course we have to send http delete request to the server.
syntax:-- DELETE/api/courses/05
>POST==
send a http post request to create a course
have to enter the proporty of the new object and send it to the server. server
will create the requirement values.
syntax:-- DELETE/api/courses
app.get('/',(req,res) => {
res.send('hello world >');
});
app.get('/api/cources', (req,res) => {
res.send([1, 2, 3]);
});