background top icon
background center wave icon
background filled rhombus icon
background two lines icon
background stroke rhombus icon

Download "Node.js #15 Интеграция БД в приложение (MongoDB Integration)"

input logo icon
Video tags
|

Video tags

web
develop
front-end
frontend
веб
разработка
программирование
обучение
education
lesson
tutorial
лекция
урок
образование
node js
node js это
nodemon
ejs
node.js tutorial
node.js курс
node.js основы
node.js для начинающих
node express
express
express router
ejs template
mongo
mongodb
node mongodb
heroku
Heroku deploy
node
node с нуля
node js уроки
node js лекции
node js основы
node.js введение
node js полный курс
yauhenk
webdev
Subtitles
|

Subtitles

subtitles menu arrow
  • ruRussian
Download
00:00:02
you are on the channel in pdf, welcome to the
00:00:04
next lesson dedicated to but Jess and in
00:00:07
this video we will transfer the
00:00:08
static data stored on the server to a
00:00:11
real database before that we will
00:00:14
create the setup and connect our server based on the
00:00:17
result of the lesson we need to get
00:00:19
an application that will write
00:00:21
posts to a database as a base I
00:00:24
will use [ __ ] db
00:00:26
if you watched the graph quelle jacket on the
00:00:28
channel there we also used this
00:00:31
database so the general mechanism should already be
00:00:34
presented if you
00:00:36
are working with databases for the first time then it’s very strong
00:00:38
Don’t worry, I’ll show you everything and
00:00:40
tell you,
00:00:41
especially since manga is one of the
00:00:44
simplest options for you, but the
00:00:46
sql database after registration you will find yourself
00:00:49
on the main page.
00:00:50
In recent years, they
00:00:52
have worked very well on this product, so the
00:00:55
interface has become much simpler and clearer,
00:00:57
and many configurations are used
00:01:00
automatically the first thing you need if this does
00:01:03
not happen automatically create a
00:01:05
cluster here everything is simple all the options
00:01:09
are by default all you need to
00:01:11
do is select the sandbox tariff
00:01:13
so that everything is free after the
00:01:16
cluster is created you need to internally
00:01:18
add a new collection for this click
00:01:21
on the collections button and create the new
00:01:24
collection, in fact, this will be our
00:01:27
database, in the pop-up window we set the name
00:01:30
for the database, since we created a blog, then
00:01:33
I’ll call it not blog, but the name of the
00:01:37
collection is directly the place
00:01:39
where the data will be saved, so
00:01:42
it must be selected in accordance with the
00:01:44
stored type so that the name is
00:01:46
descriptive in our example, I
00:01:49
will call the collection post
00:01:50
since it will store news data.
00:01:53
After we have created the database and
00:01:55
collection, we need to create a user
00:01:58
who will have access for
00:02:00
manipulation. To do this, click on the
00:02:03
database access tab
00:02:05
and either create a new user or
00:02:08
we edit the existing one
00:02:10
as an authorization method, select a
00:02:12
password, the name is set automatically
00:02:15
from the name and name that you specified during
00:02:18
registration, you need to come up with a password,
00:02:20
by the way, if it is very simple, then you
00:02:23
will receive a message about this and you
00:02:25
will need to change it; as an example, I
00:02:28
will set the password pass 321, the last thing that
00:02:32
remains select
00:02:33
this role, it can be left as administrator by default,
00:02:37
or it can be changed to read and write or
00:02:40
read only,
00:02:41
that is, depending on the selected options,
00:02:44
the user will receive either full access
00:02:46
or partial access to
00:02:49
data manipulation after the user is
00:02:50
created, we can begin integrating the
00:02:53
database into our application to begin with,
00:02:56
since we are working with manga, we will
00:02:58
need to install mangus
00:03:01
since we cannot access the database directly,
00:03:03
this can be done with the command npm install
00:03:06
mangus after installation, we import it into
00:03:10
our server, now we return back
00:03:13
to the manga website,
00:03:14
go to the cluster st tab and
00:03:16
click connect button
00:03:17
since we will connect through
00:03:20
the application, we select this option in the
00:03:23
window that appears, we will see the
00:03:25
line that we copy and transfer in the
00:03:28
application, create a debi constant where
00:03:32
and assign the copied connection string,
00:03:35
please note that this is not fully
00:03:37
configured, the line
00:03:39
that can be used
00:03:41
says the same thing message under it we need to
00:03:44
set the password field
00:03:46
and I’ll remind you we defined it as pass 3
00:03:48
2 1 and also replace my first date a
00:03:51
bass with the name of the database that we created this
00:03:54
value
00:03:55
is not a block and now we can already
00:03:58
establish a connection for this we
00:04:01
use mongus which we imported
00:04:03
earlier and in particular the method connect
00:04:06
inside of which we pass the debi constant
00:04:08
since this is also an asynchronous operation
00:04:11
we can use the dream methods to
00:04:14
flow inside the essay console you see
00:04:17
a line stating that we have successfully connected
00:04:19
to the
00:04:20
cash database if we have an error and
00:04:24
by the way it will appear We’ll also display it in the
00:04:26
console, just in case; we’ll stop and
00:04:29
restart the server; the message is
00:04:32
not displayed in the console right away, since
00:04:35
the connection is being made first,
00:04:36
but even after that we will receive a message;
00:04:39
I deliberately did not create a
00:04:41
fully prepared request so that you can see the
00:04:44
whole process; the message says that
00:04:47
we Additionally, you need to pass the
00:04:49
user argument new
00:04:51
ural parser to connect, but that’s not all you can see in
00:04:54
the console, you can see another
00:04:57
warning as an additional
00:04:59
argument is required,
00:05:01
user uni fight the shelves, we add it and
00:05:04
now that everything necessary has been added,
00:05:07
a connection should occur, but here
00:05:10
we are too we see an error about access, in order to
00:05:13
fix this, we
00:05:14
return to the [ __ ] db panel, go
00:05:17
to the network access tab and edit the
00:05:19
existing connection,
00:05:21
click on the allow access from any button
00:05:24
and save the changes, that is, we
00:05:27
allow access not from a specific IP
00:05:30
address, but from any machine to this
00:05:32
saving will take a couple of seconds, but if we
00:05:35
did everything correctly, the console should
00:05:38
display the message connect and tu bi bi,
00:05:41
if this does not happen for you, then read the
00:05:44
error message or warning
00:05:47
and try to find the answer
00:05:48
yourself, as a result,
00:05:50
you should have established a connection
00:05:52
between the server and the database is
00:05:55
great, now let's move on to creating schemas. A
00:05:58
schema
00:05:59
is a kind of object that will
00:06:01
describe the data structure in the root of the
00:06:04
project, create a modus folder and
00:06:07
add the post file to it. jess inside this
00:06:10
file we will describe the scheme of our post,
00:06:14
first we import mongus and pull the
00:06:17
constructor from it and now we create a
00:06:20
constant post scheme
00:06:21
and assignment call the constructor inside
00:06:24
which we describe the object if we
00:06:27
go to the file server and look at the
00:06:30
structure of our post you will see what
00:06:33
it contains fields such as
00:06:34
ideas, text, title, and so on, these are the fields
00:06:38
we need to describe
00:06:40
the properties of the ID, we don’t describe it since we do
00:06:43
n’t transfer it, it will be created
00:06:45
automatically for each added
00:06:48
entity, we’ll start right away with the text field,
00:06:51
its type, this line, we
00:06:53
can finish there but
00:06:55
in addition I will add an even more record
00:06:58
with the value true,
00:06:59
as you might guess, now the text is
00:07:02
required and properties, and if it is not
00:07:05
passed, there will be an error. Then we simply
00:07:08
copy the same construction for the properties
00:07:10
title and author, these are also strings, these are also
00:07:14
required fields as the
00:07:15
second argument to the constructor you can
00:07:18
pass a configurable object, I’ll
00:07:20
use it to pass the
00:07:22
time stands properties,
00:07:23
this is exactly the one and the one that
00:07:25
will now be automatically assigned to any
00:07:28
created paste and in general the scheme is ready,
00:07:31
now this scheme needs to be applied to the
00:07:33
model for this I create a constant post the
00:07:36
name of the model is written with a capital letter just
00:07:39
like the name of the constructor, we assign
00:07:42
it the value mongus mode inside of which
00:07:45
we pass two arguments, the first is the name of the
00:07:48
model 2
00:07:49
is the name of the schema that this model
00:07:52
will use so that you can more
00:07:54
clearly understand how Mangus and
00:07:57
[ __ ] db are connected and also why use the schema,
00:08:00
look at the following figure,
00:08:02
as was said by manga debi, this
00:08:05
database that stores all information
00:08:08
directly with the database cannot be worked with because
00:08:11
as a result of incorrect implementation, a
00:08:13
situation may occur when the
00:08:15
stored data will be in different formats of
00:08:17
different structures with different types, to
00:08:20
prevent this from happening, an
00:08:22
additional layer is used between the server
00:08:24
and the database in our case, this is mongus, with
00:08:28
the help of it, firstly, we establish
00:08:30
a connection and secondly,
00:08:32
using models we can describe different
00:08:34
entities, for example in our application
00:08:37
this is a given posts and contacts model,
00:08:40
this is a wrapper around data of a certain
00:08:43
type that provides convenient
00:08:45
methods for working with this data by
00:08:48
type of reading all
00:08:49
or 1 change search or delete
00:08:52
each entity this set is available
00:08:56
and in turn the model is described
00:08:58
using a schema the schema is a
00:09:00
set of fields
00:09:02
whose types and their properties are defined
00:09:04
we return back to the code as the
00:09:06
final step we export the model
00:09:09
for this using the
00:09:11
export module assign the value to the
00:09:13
created model, go to our
00:09:16
server file and import the newly
00:09:18
created model,
00:09:19
look for the road post with which
00:09:22
we added data in the previous video and
00:09:25
slightly change its logic,
00:09:27
leave only the destructuring of the data
00:09:30
from the request using the post model,
00:09:32
collect a new post object inside the
00:09:35
constructors, pass the received ones to
00:09:37
request data after which we use a
00:09:39
simple
00:09:40
safe method, it is also asynchronous,
00:09:43
so we can process the incoming
00:09:45
result in zen using the rest method and
00:09:49
send the data to yuan, that is, if
00:09:52
everything is saved successfully,
00:09:53
we will see the saved data in the browser,
00:09:56
but in the oven we will intercept the error and
00:09:58
do additional redirect to the
00:10:00
error page, now go to the
00:10:03
browser to the post creation page,
00:10:05
enter the title, author's name and text,
00:10:09
click submit and voila on the screen we
00:10:12
see a response from mango to you that the
00:10:15
data was successfully saved,
00:10:16
this can be determined by the additional
00:10:19
fields ID
00:10:20
created it and update from from if we
00:10:24
will return to the manga and look at the
00:10:26
result, we see the sent data
00:10:28
as saved, and since all
00:10:31
the fields are marked as required,
00:10:33
we can try the negative case, that
00:10:36
is, send empty data, in this
00:10:38
case
00:10:39
we will be redirected to the error page in
00:10:41
the terminal, we will see the information that
00:10:43
we are trying send invalid data and
00:10:46
if we look at [ __ ] db then this
00:10:49
invalid data, since it did not pass the
00:10:51
schema check, was not added to the
00:10:53
database and today I still have all
00:10:56
the questions ask them in the comments and
00:10:58
you will find the lesson code in the course repository
00:11:00
link in the description see you in the next
00:11:03
video bye

Description:

Всех приветствую в курсе «Node.js». В данном видеокурсе мы с вами рассмотрим Node.js, серверную технологию которая позволяет исполнять код написанный на JavaScript вне браузера. Разберём базовые концепции и встроенные модули, которые активно используются при разработке сервера. Рассмотрим механизм коммуникаций между сервером и браузером. Создадим базовый роутинг на чистом Node.js. Подключем Express и перепишем роутер. Научимся работать с динамичными данными с помощью шаблонизатора Node.js. Напишем новостное приложение с поддержкой CRUD операций и хранением данных в MongoDB. Создадим свой API по возврату данных из БД. И в заключение, загрузим готовое приложение на Heroku. ✒ Репозиторий курса: ✔ GitHub: https://github.com/YauhenKavalchuk/node-js ✒ Полный список готовых и планируемых курсов: ✔ Trello: https://trello.com/b/R6rD7qq8 ✒ Автор курса: ✔ YouTube: https://www.youtube.com/YauhenKavalchuk ✔ Instagram: https://www.facebook.com/unsupportedbrowser ✔ Twitter: https://twitter.com/YauhenKavalchuk ✔ VK: https://vk.com/YauhenKavalchuk ✔ LinkedIn: https://www.linkedin.com/in/YauhenKavalchuk ✔ GitHub: https://github.com/YauhenKavalchuk ✔ VK (Группа): http://vk.com/webdevcom ✒ Поддержать развитие канала: https://github.com/YauhenKavalchuk/youtube/blob/main/sponsoring.md

Preparing download options

popular icon
Popular
hd icon
HD video
audio icon
Only sound
total icon
All
* — If the video is playing in a new tab, go to it, then right-click on the video and select "Save video as..."
** — Link intended for online playback in specialized players

Questions about downloading video

mobile menu iconHow can I download "Node.js #15 Интеграция БД в приложение (MongoDB Integration)" video?mobile menu icon

  • http://unidownloader.com/ website is the best way to download a video or a separate audio track if you want to do without installing programs and extensions.

  • The UDL Helper extension is a convenient button that is seamlessly integrated into YouTube, Instagram and OK.ru sites for fast content download.

  • UDL Client program (for Windows) is the most powerful solution that supports more than 900 websites, social networks and video hosting sites, as well as any video quality that is available in the source.

  • UDL Lite is a really convenient way to access a website from your mobile device. With its help, you can easily download videos directly to your smartphone.

mobile menu iconWhich format of "Node.js #15 Интеграция БД в приложение (MongoDB Integration)" video should I choose?mobile menu icon

  • The best quality formats are FullHD (1080p), 2K (1440p), 4K (2160p) and 8K (4320p). The higher the resolution of your screen, the higher the video quality should be. However, there are other factors to consider: download speed, amount of free space, and device performance during playback.

mobile menu iconWhy does my computer freeze when loading a "Node.js #15 Интеграция БД в приложение (MongoDB Integration)" video?mobile menu icon

  • The browser/computer should not freeze completely! If this happens, please report it with a link to the video. Sometimes videos cannot be downloaded directly in a suitable format, so we have added the ability to convert the file to the desired format. In some cases, this process may actively use computer resources.

mobile menu iconHow can I download "Node.js #15 Интеграция БД в приложение (MongoDB Integration)" video to my phone?mobile menu icon

  • You can download a video to your smartphone using the website or the PWA application UDL Lite. It is also possible to send a download link via QR code using the UDL Helper extension.

mobile menu iconHow can I download an audio track (music) to MP3 "Node.js #15 Интеграция БД в приложение (MongoDB Integration)"?mobile menu icon

  • The most convenient way is to use the UDL Client program, which supports converting video to MP3 format. In some cases, MP3 can also be downloaded through the UDL Helper extension.

mobile menu iconHow can I save a frame from a video "Node.js #15 Интеграция БД в приложение (MongoDB Integration)"?mobile menu icon

  • This feature is available in the UDL Helper extension. Make sure that "Show the video snapshot button" is checked in the settings. A camera icon should appear in the lower right corner of the player to the left of the "Settings" icon. When you click on it, the current frame from the video will be saved to your computer in JPEG format.

mobile menu iconWhat's the price of all this stuff?mobile menu icon

  • It costs nothing. Our services are absolutely free for all users. There are no PRO subscriptions, no restrictions on the number or maximum length of downloaded videos.