Activa JavaScript para disfrutar de los vídeos de la Mediateca.
Back end vs Front end - Vídeo 15 B - Contenido educativo
Ajuste de pantallaEl ajuste de pantalla se aprecia al ver el vídeo en pantalla completa. Elige la presentación que más te guste:
Trabajando con tareas. Parte B
ok well I was making the mistake with the law the problem was after looking at it all and
00:00:00
going back half crazy is that we were missing here I had not put the two points here ok then
00:00:11
when the leader passed him if I did not pass these two points he did not recognize it as the parameter
00:00:17
then I was not saying that I did not find that route with the subject of the update
00:00:23
you also have to pass it we are going to pass those two that there is worth it and now it works for me if we are
00:00:30
in our database I see that there is no document in user I have the user of miguel ok
00:00:44
we are going to create ourselves or we are logged we are going to start launching different
00:01:00
petitions is worth then the first is to create a consultation a new task a new task
00:01:07
then I am going to put the post we are going to put the task here and I am going to tell it that the title is task 1
00:01:17
and this is a task 1 test ok this I give it to sense ok it creates the task if we look we are going to
00:01:29
copy the idea of the task that is this
00:01:38
worth that ends in 4 c control is worth in tasks and we will have created it here
00:01:44
we have it if we look for now in what
00:01:52
we look for all the tasks
00:01:58
all the tasks of miguel is worth right now I only have this one but it already gives me
00:02:01
as I was not doing it well, it is worth if we look for only the task with that and it will also give it to me
00:02:09
, it is worth only this one that I only have that one, but it is no longer working and if what I want
00:02:18
is to delete that task then I am going to pass the law the task of the ip that is the idea
00:02:24
I give it to be a erased task, now it is already fine and it was for the two points this is good
00:02:33
because it would be and the law no longer works now we are going to the update we are missing the update then
00:02:42
let's go to our fichero to the controller the controller and in the update what we are going to do is
00:02:53
as well as until now, it is worth if always constant tasks is equal to
00:03:04
these points fine
00:03:11
go there and it is worth finding the air and updating it is worth and this is going to take us the
00:03:16
network point params point and d
00:03:25
ok and we are going to tell him ok because this one does receive more input parameters
00:03:30
the update is first is what document we want to modify ok that is the one I take for the
00:03:41
and then it is that in the field I want to update it is worth that we are going to take it by the
00:03:50
body network is worth and second and third sorry when we are working with mongo db when
00:03:59
an update is made in memory the document remains without the update even if it is
00:04:08
updated, it is worth then to update it you have to pass it a third parameter
00:04:15
which is an option, it is worth that it is mine the new one and you put it to true, it is worth that way it will always
00:04:23
show you the last one, it is worth here as we have said before we say if there is no task, that is, there is some
00:04:32
type of problem you are going to do a returnt
00:04:42
res.status 404
00:04:47
json json
00:04:53
two points
00:05:03
the same task not found is worth and
00:05:07
If everything is fine, then what we are going to do is a res json that sends us the front, the task, okay?
00:05:15
And there we would already see it updated because we have put the new to true.
00:05:25
If we don't pass this third parameter, then it will visualize the old one, okay?
00:05:31
And that's what I don't want.
00:05:35
Okay, let's try it.
00:05:37
then we are going to create a new task because we have already deleted the other one, I come here,
00:05:38
I am going to remove it, we are going to put a post, we are going to create a new task that is title 1, we are going to put it
00:05:49
because title 1 this is a test, we already have it created if we come to the database we have it
00:06:00
has not just created it, we are going to take that idea and that task control c we are going to put the put
00:06:08
we are going to pass it that there is another light and I am going to tell it the field that I want to modify the key
00:06:22
value that I want to modify, which in this case is going to be
00:06:33
we are going to put the title to instead of task 1 we are going to change it to
00:06:40
example class
00:06:50
ok ok this I send it
00:06:58
ok, this has given me a problem in the json, let's see if it has come to us to modify it, where are you here,
00:07:02
controller, add day, receive start, return res status, 404.json, task, task,
00:07:31
And this one we have put as PUT, here we have put PUT task, bar id, this is fine, localhost 4000 villablanca don tareas task, the id, we put the PUT, title, example, class 1.
00:07:54
This is the user and this is the ID of this document
00:08:19
we are connected
00:08:37
everything is fine
00:08:45
control v that is fine and if we give the send
00:08:51
it gives us the error
00:08:55
the connection was rejected by the server
00:08:58
let's see
00:09:02
let's see if it's because I'm missing here
00:09:09
in the web then we are in our consultation
00:09:12
we have the idea of put now yes now the title has changed to
00:09:20
example class is no longer title 1 if we want to change the description
00:09:29
This is the example of the class that we are doing the video and we would already have all the
00:09:48
CRUD operations that can be done on MongoDB. Well, in principle we would already have our
00:10:03
backend, we would already have our API with its endpoints and we could connect to it and start
00:10:10
to work, okay, because there is also the network, it receives us, it sends us well from the client to the
00:10:16
server and from the server to the client, all the json, okay, it would be now, man, we have this
00:10:23
folder that is from the schemes that we have not used, then this is to do more validations
00:10:31
in the end we are all the time sending and receiving data in addition to being seeing that the issue
00:10:37
of authentication, which is very important,
00:10:45
okay, what we are going to put is more validation rules, okay, and I'll leave that
00:10:51
for the next video, a greeting, see you later
00:10:58
- Idioma/s:
- Idioma/s subtítulos:
- Autor/es:
- Mario S.
- Subido por:
- Mario S.
- Licencia:
- Dominio público
- Visualizaciones:
- 14
- Fecha:
- 16 de julio de 2024 - 12:30
- Visibilidad:
- Público
- Centro:
- IES VILLABLANCA
- Duración:
- 00′ 13″
- Relación de aspecto:
- 1.78:1
- Resolución:
- 1920x1080 píxeles
- Tamaño:
- 28.15 MBytes