YouTube2Text

node js interview | fresher | round - 1| node Js #nodejs #mernstack #javascript #interview — Transcript

by Harsh Pathak · 4,324 words · 612 segments · language en · Watch on YouTube

Full transcript

  1. 0:06Hello
  2. 0:10Vive. Hello. Hello. How are you? Yes
  3. 0:14sir, I'm good sir. Very good sir. Okay.
  4. 0:16So today is your NodeJS interview and
  5. 0:19this is your first right? Uh yes sir.
  6. 0:23Okay. So can you please tell me
  7. 0:25yourself?
  8. 0:27Okay. So uh sir my name is Vive Bhardwaz
  9. 0:30and I am a student of BCA. Uh currently
  10. 0:34I'm in my fourth semester and I have
  11. 0:36been practicing web development uh
  12. 0:38Mstack from the past one year and I have
  13. 0:41been building projects in this
  14. 0:44mstack also sir I'm learning new tech
  15. 0:46stacks other than M stack. Okay. So
  16. 0:50currently you are fresher right? Uh yeah
  17. 0:53I'm a fresher. Okay. And you are
  18. 0:56learning
  19. 0:58monsted my monster tag. Right now I'm
  20. 1:00learning other text tags such as like uh
  21. 1:03C++ and Java because such things are
  22. 1:06taught in my college. And uh you already
  23. 1:08give the React interview, right? Yes
  24. 1:10sir. I I have given the React interview.
  25. 1:13Okay, great. So let's start with the
  26. 1:16basic NodeJS question. Okay. Uh so first
  27. 1:19of all, what is the NodeJS? So
  28. 1:23NodeJS is a JavaScript runtime
  29. 1:26environment which is used to run
  30. 1:27JavaScript code outside the browser. We
  31. 1:30use NodeJS mainly to build uh the back
  32. 1:33end of our website. For the APIs and all
  33. 1:36we use NodeJS.
  34. 1:38Okay. So what is the difference between
  35. 1:41NodeJS and JavaScript?
  36. 1:43So sir, JavaScript is a scripting
  37. 1:46language. It is used in the browser. we
  38. 1:49cannot use uh like it is used in the
  39. 1:52browser but but when it comes to the
  40. 1:54back end in there we use NodeJS
  41. 1:57okay uh to create our like server make
  42. 2:01APIs for that okay so you mean because
  43. 2:04in the NodeJS in the NodeJS we cannot
  44. 2:07use HTML no that's why okay so is NodeJS
  45. 2:12is a single threaded or not uh NodeJS is
  46. 2:16a uh NodeJS is a single thread added
  47. 2:19event driven based on event-driven
  48. 2:21architecture.
  49. 2:23Okay. So what kind of API function is
  50. 2:26supported by NodeJS?
  51. 2:28API functions asynchronous and
  52. 2:31synchronous.
  53. 2:33Okay. So can you please explain brief
  54. 2:36about uh what is the synchronous and
  55. 2:38asynchronous? Okay. So are asynchronous
  56. 2:41and synchronous are like is asynchronous
  57. 2:43blocks the execution of the uh sorry
  58. 2:46synchronous functions block the
  59. 2:48execution of the code while asynchronous
  60. 2:50functions don't block the execution of
  61. 2:52the code.
  62. 2:54Okay. So can you give me the like
  63. 2:57difference between promises and a sync
  64. 3:00aait? Uh yeah sir in the like uh uh in
  65. 3:04the promises we use promises to like to
  66. 3:07overcome from the situation of call back
  67. 3:09hell and async aait is async is also
  68. 3:14just another term of promise. So in the
  69. 3:17promise like we uh in the promise there
  70. 3:20involves quite steps such as when we we
  71. 3:23create promise and then we consume
  72. 3:25consume that promise and uh like uh
  73. 3:28promise we use to work in an
  74. 3:31asynchronous nature. So for that we use
  75. 3:33promise. Okay. So which one you prefer
  76. 3:36promise and async? Sir I go with async.
  77. 3:41Okay. So what is a module in NodeJS sir?
  78. 3:45In a module in NodeJS is like it's a
  79. 3:48JavaScript it's a in NodeJS every file
  80. 3:53is a module in itself. So we use the
  81. 3:56require function to import that modules
  82. 4:00and then we use that code. Okay. So what
  83. 4:05is npm and its advantage? Uh sir npm npm
  84. 4:10stands for node package manager. uh np
  85. 4:13we can install multiple packages in our
  86. 4:15application using npm. So we can also
  87. 4:19publish we can create and publish our
  88. 4:21own package to our npm and from there we
  89. 4:23can install for the for the windows it
  90. 4:26goes with like npmi something and for
  91. 4:29the like uh yarn we use that something
  92. 4:33for so can you give me the like flow of
  93. 4:36like how to start NodeJS in our
  94. 4:38application. Okay. So, so first we need
  95. 4:42first we need to like uh so starting
  96. 4:44like we need to create a folder and in
  97. 4:47the folder we create our file and inside
  98. 4:49file we open it in our VS code like any
  99. 4:52uh uh and then we write npm init y to
  100. 4:57like init uh initialize the nodejs in
  101. 4:59that and then we npmi for installing the
  102. 5:02node modules. Uh we need to set up like
  103. 5:05expressjs for creating our server. uh we
  104. 5:08install express app. Then uh after
  105. 5:11installing uh the express module we we
  106. 5:14uh like const app is equals to express.
  107. 5:17Then we create a simple server such as
  108. 5:19like app.get/ something and then we uh
  109. 5:23we listen that using app.list to a
  110. 5:26specific port and then our server
  111. 5:28starts. It's a basic server it starts.
  112. 5:31Okay. You say expressjs, right? So can
  113. 5:34we create API without express? Yeah, we
  114. 5:37can create APIs in like NodeJS which is
  115. 5:40a default HTTP module but uh it I I have
  116. 5:44tried creating using uh without express
  117. 5:46but it's a it gets it gets like the code
  118. 5:50gets quite messy. So I don't prefer
  119. 5:52creating APIs using NodeJS.
  120. 5:56Okay. So like which framework you prefer
  121. 6:00in NodeJS ExpressJS or any other? No sir
  122. 6:04I only go with ExpressJS.
  123. 6:06Okay. So what is middleware in NodeJS?
  124. 6:10Okay. So middleware in NodeJS sir it
  125. 6:13acts uh sir it's like a middleman
  126. 6:16between the client which is sending the
  127. 6:19request and the and the server which
  128. 6:22will send the response. So can I tell it
  129. 6:27with an example? Yeah sure. So suppose
  130. 6:30like uh client is sending a query
  131. 6:34parameter of age and in the back end we
  132. 6:37have created uh we have created our the
  133. 6:39API and inside that we have like using
  134. 6:42our middleware in the middleware we are
  135. 6:44checking if the age which is coming is
  136. 6:47greater than 18 then we will allow the
  137. 6:50user to get the response. If the age
  138. 6:53user sends is like 16 or 17 then we can
  139. 6:57show him an error message that you are
  140. 6:59not allowed to use our server such as in
  141. 7:02that case we use middlewares. Okay
  142. 7:04great. So how does NodeJS handle
  143. 7:07concurrency even after being single
  144. 7:09threaded? Uh okay so sir I I I know that
  145. 7:14NodeJS uses something called liup
  146. 7:16library for handling all async calls
  147. 7:18asynchronous calls. Okay. So what is the
  148. 7:22control flow in NodeJS?
  149. 7:24Sir, control flow in NodeJS it is used
  150. 7:26for handling callbacks. It uh it defines
  151. 7:30the order in which uh it defines the it
  152. 7:33it defines in which the it defines the
  153. 7:36order of the call back function.
  154. 7:39Okay. So what do you mean by event loop
  155. 7:42in NodeJS?
  156. 7:44So event loop uh event event loop event
  157. 7:48loop uh I have heard event loop sir
  158. 7:52event loop is like uh call back only uh
  159. 7:56it is b event loop there are two two
  160. 7:59like components uh
  161. 8:01two what we say
  162. 8:03like event loop is used in callbacks and
  163. 8:07something
  164. 8:10uh event yeah sir call back In the event
  165. 8:14book it comes like call back something.
  166. 8:17Okay no worry. Uh after interview please
  167. 8:21check it out because the main question
  168. 8:23in NodeJS. Sure. Okay. So what are the
  169. 8:26main disadvantage of NodeJS? Sir uh
  170. 8:30NodeJS is a NodeJS is a single threaded
  171. 8:33language. So uh when we want to like
  172. 8:36build uh like when we are dealing with
  173. 8:39like when we are when we want to build a
  174. 8:40bigger application at that time it won't
  175. 8:43be like good for the performance. So
  176. 8:46there are other alternatives such as
  177. 8:48like python which works on
  178. 8:49multi-threaded so we can use that it
  179. 8:52python also helpful in creating the web
  180. 8:54APIs and all. Okay. So can we use both
  181. 9:00database in NodeJS like relational and
  182. 9:02non relational? Uh yes we can use both
  183. 9:05database in NodeJS like XQ and MongoDB
  184. 9:08but mainly we use sir MongoDB in our
  185. 9:10back end with NodeJS.
  186. 9:14So what is ripple environment in NodeJS?
  187. 9:18Uh yeah sir uh ripple stands for read
  188. 9:20evaluate print and loop. uh it's like
  189. 9:24command line uh command line uh
  190. 9:27function. So uh it is it is helpful in
  191. 9:30debugging the code like performance
  192. 9:32checking something for that we use in
  193. 9:34the
  194. 9:36shell ripple command. Okay. So can you
  195. 9:40give me any like example module in
  196. 9:44NodeJS we have already inbuilt? Yeah,
  197. 9:47there are inbuilt modules such as HTTP
  198. 9:50OS module, DNS module. Uh these are path
  199. 9:54module, uh FS module. Yes, these are FS
  200. 9:57module is the most of the time we use it
  201. 10:00in our code.
  202. 10:02Okay. Uh
  203. 10:05okay. Then what is the packet dojson in
  204. 10:08NodeJS? Uh so package.json is a file
  205. 10:12like uh it contains package.json
  206. 10:15uh basically have the information what
  207. 10:18are the like packages we what are the
  208. 10:21modules like we are using in our
  209. 10:23applications such as what expresss if we
  210. 10:26have installed express course then it
  211. 10:28shows like okay so these are the
  212. 10:30packages which are being used in this
  213. 10:31application okay suppose uh I want to
  214. 10:35write hello world in server okay so how
  215. 10:39can I do
  216. 10:42okay so uh so You you want me to tell
  217. 10:45that code like how to write hello world
  218. 10:47and show it to a show so show show it to
  219. 10:49the client. Yes. Okay. So we so we can
  220. 10:53uh create a a simple express server and
  221. 10:56in that we like constant without express
  222. 11:00then okay. So without without express
  223. 11:02then we can go with con http require
  224. 11:05http then uh we create that server like
  225. 11:08http.pre create server inside that call
  226. 11:10call back function we path like if
  227. 11:13request dot URL is equals to slash then
  228. 11:16rest dot send hello world and we listen
  229. 11:19to that on a specific port such as 4,000
  230. 11:23if the user visits the homepage slash
  231. 11:26then we can show him the hello world
  232. 11:28okay great so why we use expressjs
  233. 11:34expressjs is built on top of nodejs but
  234. 11:37and It is very helpful like for creating
  235. 11:40the web API. It makes our code like more
  236. 11:44uh readable. Okay. Yeah. And uh what are
  237. 11:49promises in NodeJS? Yeah. Promises in
  238. 11:52NodeJS uh like I have told earlier just
  239. 11:55like it's another term of
  240. 11:57using asyn so promises like uh we in the
  241. 12:03fs module s we use promises such as con
  242. 12:05fs is equals require fs.promises.
  243. 12:08promises. So what happens there? Like if
  244. 12:10we want to read the contents of a file
  245. 12:13then if we don't use promises now then
  246. 12:16we need to send a call back function. If
  247. 12:19we use fspromises then we don't need to
  248. 12:22send the function. We can just simply
  249. 12:24use like dot then and we can get the
  250. 12:26data of the file. Uh what is eventdriven
  251. 12:29programming in NodeJS?
  252. 12:32event driven programming in NodeJS is
  253. 12:34based on call backs uh is b is based on
  254. 12:38call back only sir. Okay. So there we we
  255. 12:41are have when we want when we are
  256. 12:42dealing with events such as API calls in
  257. 12:45that case uh we call it an event-driven
  258. 12:47programming.
  259. 12:49So what is buffer in NodeJS?
  260. 12:52Yeah buffer is just like it's a binary
  261. 12:55data. So it's is a temporary storage for
  262. 12:58binary data. um we call it a buffer
  263. 13:01class. It's an instance of buffer class.
  264. 13:04So like if you want to create a normal
  265. 13:07buffer such as con buffer is equals to
  266. 13:09buffer dot from like hello world comma
  267. 13:12and I have to pass the encoding such as
  268. 13:14UTF8 and if if I like console.log that
  269. 13:17buffer then it will give such as like
  270. 13:19buffer some hexa decimal number and if
  271. 13:22we want to get in a readable string then
  272. 13:24we write such as con console.log log
  273. 13:27buffer dot2 string and that's it. We get
  274. 13:30the actual readable string. Okay. So
  275. 13:34what are streams in NodeJS? Yeah. So
  276. 13:37streams in NodeJS are the objects like
  277. 13:41uh uh it's a very helpful thing in
  278. 13:43NodeJS like when we are dealing with a
  279. 13:46lots of data. Now at that time we can
  280. 13:49use stream. So for example in the back
  281. 13:51end like I have my uh I have my like
  282. 13:54video or any text file which is uh which
  283. 13:56is a very great which is a very large MB
  284. 13:59large MB and when the client request for
  285. 14:02that file if we are directly sending
  286. 14:04that file then it can be like very uh
  287. 14:08high load on the memory. So to avoid
  288. 14:10that we use streams. So what what I'm
  289. 14:13saying that using streams we can send
  290. 14:15data chunk by chunk. Okay. Yeah, that's
  291. 14:19the main uh use case of strings sending
  292. 14:22data chunk by chunk. Okay, so what is
  293. 14:25call back hell?
  294. 14:27Yeah, call back hell is like when we are
  295. 14:30performing nesting of callbacks call
  296. 14:32back inside call back then we call it a
  297. 14:35call back call back hell and and the
  298. 14:38virtual representation of call back hell
  299. 14:40is known as pyramid of doom something
  300. 14:43like this. Okay. So can you explain me
  301. 14:46like uh use of timer module in NodeJS?
  302. 14:50Timer module. Timer module sir we use
  303. 14:53like Mhm. Uh set time out and set Yeah,
  304. 15:00that is only now we use that timer
  305. 15:01module.
  306. 15:03Yeah. Yeah. Yeah. In the set timeout
  307. 15:05like we can use set timeout fun in the
  308. 15:07set timeout in the inside that call back
  309. 15:09we pass like console.log log name and we
  310. 15:11pass the like the time at which it
  311. 15:14should go like I'm if I pass thousand
  312. 15:17then thousand stands for 1 second and
  313. 15:19then it will print it after 1,000
  314. 15:22second. Okay. So what is body parser in
  315. 15:25NodeJS?
  316. 15:27Okay. So body parser is like we use like
  317. 15:30when when the when the data is coming
  318. 15:33from the client it comes in like uh the
  319. 15:36it comes in like the JSON format. So we
  320. 15:39need to parse that data. So for that we
  321. 15:42use body parcel. Okay. Okay. And and
  322. 15:46also like from the express it's a by
  323. 15:49default we don't need to install any
  324. 15:50other package like body parcel. We can
  325. 15:52use app dot use express.json something
  326. 15:55like this to parse the data coming from
  327. 15:58the front end. Okay. Uh what is course
  328. 16:00module in NodeJS and why we use? Yeah.
  329. 16:04Code stands for cross origin resource
  330. 16:07sharing. So sir this module is very
  331. 16:09helpful like uh it it restricts like uh
  332. 16:14the it restricts the
  333. 16:17from getting called from other other URL
  334. 16:21such as like my server is running on
  335. 16:244,000 and if my client is running on
  336. 16:273,000 then if if I don't use the course
  337. 16:30module then it will show me the error of
  338. 16:34cross origin resource policy something
  339. 16:36like this and so To tackle this error,
  340. 16:38we need to import uh we need to use the
  341. 16:41course module then our API will get
  342. 16:43called. Okay. So, how can we implement
  343. 16:46authentication in NodeJS?
  344. 16:49Okay. So, for implementing a
  345. 16:51authentication there's a very great
  346. 16:53library called JWT uh yeah JSON web
  347. 16:57token we call it. So, using that we can
  348. 17:00implement authentication. So, suppose
  349. 17:02like I have created the register and
  350. 17:04sign in APIs. So after registration when
  351. 17:08the user sign in and if the user's
  352. 17:10password gets matched at that time we
  353. 17:13generate a token and send and set it in
  354. 17:16the local storage and uh that token is
  355. 17:19basically generated by JWT called JSON
  356. 17:22web token. Great. So explain the package
  357. 17:27used for file uploading in NodeJS.
  358. 17:30Okay. So uh there are there are multiple
  359. 17:33packages for file uploading in NodeJS.
  360. 17:36Uh but the most popular one is the
  361. 17:39malter. We use the malter package to
  362. 17:42like upload our images and all to the
  363. 17:46but sir what uh in the multter it
  364. 17:49doesn't upload our image to the database
  365. 17:52only we are saving the like the image
  366. 17:54path or image name to the database.
  367. 17:56Actually the image gets stored it in our
  368. 17:59server folder.
  369. 18:01And which package you use for the mail?
  370. 18:05For the email uh sending mail from the
  371. 18:08NodeJS.
  372. 18:10Yeah. So for that we use the node mailer
  373. 18:12package uh to send the email from the
  374. 18:15our server.
  375. 18:17Okay. So can you give me the example of
  376. 18:20how we can connect database with our
  377. 18:23NodeJS? Okay. So for connecting the
  378. 18:26database. So suppose I'm using the
  379. 18:29MongoDB Atlas database. So for that
  380. 18:32first we need to like uh first obviously
  381. 18:34first we need to create our account on
  382. 18:36MongoDB Atlas and we get the like the
  383. 18:38our URL database URL and after that we
  384. 18:41need to like install package called
  385. 18:44mongus and in that uh we after importing
  386. 18:49mongus then we use like mongus.connect
  387. 18:51connect and we pass our pass the URL and
  388. 18:54then we then it returns a promise then
  389. 18:57dot then after that we get that our
  390. 19:00server is connected to the database and
  391. 19:02after that we can perform multiple
  392. 19:04operations such as uh updating deleting
  393. 19:07etc. Great. So how to handle environment
  394. 19:10variable in NodeJS. Okay. So handling
  395. 19:14environment variables we use a package
  396. 19:17called env. So, env package we install
  397. 19:22it and then we can get uh the
  398. 19:24environment variables. So, for the like
  399. 19:26passwords and other security uh
  400. 19:29confidential data we keep it in our
  401. 19:33env package we get those data from the
  402. 19:37env file. Okay. And uh which package you
  403. 19:41use for the your password be crypt in
  404. 19:45NodeJS? Oh, the Okay.
  405. 19:48to decrypt JS for hashing my password at
  406. 19:52the time when user
  407. 19:55user user when signups at that time we
  408. 19:58use decryptJS.
  409. 20:01Okay. So can you explain me like folder
  410. 20:05structure of our NodeJS project? Okay.
  411. 20:08So the the ideal folder structure should
  412. 20:12be based on MVC model view controller.
  413. 20:14Mhm. So uh first we create the model
  414. 20:17folder. Inside that we define the mo
  415. 20:19inside that we define like our the
  416. 20:21database schema and models and in the in
  417. 20:25the controller in the controller section
  418. 20:27like we create our controllers of the
  419. 20:30routes uh like such as
  420. 20:32app.get/ api and then we then we have
  421. 20:36our own logic which is in store which is
  422. 20:38stored in in our controller folder.
  423. 20:41Okay. So it makes our code code more
  424. 20:43readable and optimized.
  425. 20:46Okay.
  426. 20:48So what is EGS?
  427. 20:52Uh yeah EGS EGS is used for like uh EGS
  428. 20:56uh when I was like uh learning NodeJS at
  429. 20:59that time I used EGS but right now sir I
  430. 21:03don't have that much uh that that much
  431. 21:06like uh practical exposure in EGS. So
  432. 21:09yeah, I I know that we can uh we can
  433. 21:12perform such as our we can write our
  434. 21:15JavaScript function inside EGS. Mhm.
  435. 21:18Okay. Yeah, something like this we use
  436. 21:20EGS.
  437. 21:26Okay. Uh can you give me like difference
  438. 21:29between uh query params and request
  439. 21:32params?
  440. 21:34Query params and request.params. Okay.
  441. 21:37So uh query params. Yes. Uh so suppose
  442. 21:40uh my API endpoint is like https
  443. 21:44something
  444. 21:46example.com/appi and then there's a
  445. 21:48question mark and then question mark and
  446. 21:51then we write age is equals to 10 10
  447. 21:54then this goes in query parameter and if
  448. 21:57my URL is like this
  449. 22:00example.com/appi / 10 then that / 10
  450. 22:04goes in like request.params. params.
  451. 22:07Okay,
  452. 22:08great. And uh have you implement like
  453. 22:12Google authentication and Yeah, I have
  454. 22:14implemented Google authentication. Uh we
  455. 22:16use a package called
  456. 22:19passportjs and also for and also like to
  457. 22:22we have to like create our account in
  458. 22:25console.google.com. So get there we get
  459. 22:27a lots of secret keys and then we like
  460. 22:32integrate and we can start we are done
  461. 22:36with our like Google login. Mhm. Okay.
  462. 22:41So have you heard about websocket? Yeah
  463. 22:44I have heard about webocket. In fact I
  464. 22:46have used in most of my applications. We
  465. 22:49there's a library called socket.io
  466. 22:52uh for the back end and for the front
  467. 22:54end it is socket.io IO client. Uh can
  468. 22:58you give me like example like how you
  469. 23:00can use in back end? Okay. So in the
  470. 23:04back end
  471. 23:05uh okay so we need to like install our
  472. 23:09socket.io and then uh I don't actually
  473. 23:12remember the code. I remember like the
  474. 23:14functionalities I've been implementing
  475. 23:15such as like uh the chat app. Okay. I uh
  476. 23:19I I remember like const something with
  477. 23:22diff const client from like
  478. 23:25socket.io and then we like create our
  479. 23:28the create our such as socket.io
  480. 23:32integrate then after like setting up our
  481. 23:34socket.io IO we define such as IO IO dot
  482. 23:38then we define io
  483. 23:39dot/ IO dot sorry then in that we define
  484. 23:44such as method such as IO do on and in
  485. 23:47the IO.on we get the data and we send
  486. 23:50send it as socket. and we write like uh
  487. 23:54message and we send that data and in the
  488. 23:57in the front end I have to use that
  489. 23:59socket on message and and there's a call
  490. 24:02back data and if we console.log we get
  491. 24:05that data. Okay. So how we can manage
  492. 24:09session in NodeJS?
  493. 24:12So uh NodeJS sessions sorry sir I didn't
  494. 24:16get uh have you work with like Google
  495. 24:19authentication right? Yeah. Google
  496. 24:22authentication app. Okay. So in the
  497. 24:23Google authentication like session like
  498. 24:27uhhuh session. Yes. Yes. There's a
  499. 24:30package called extract session. So that
  500. 24:32we use uh in the express session it
  501. 24:35stores like the which user has logged
  502. 24:38into our application. So session cookies
  503. 24:41and local storage are used for like uh
  504. 24:43the user uh data storage such as uh so
  505. 24:47the back end knows like which user is
  506. 24:49sending the API request.
  507. 24:52Okay great.
  508. 24:56So can you give me like example like how
  509. 24:59you can create your database model?
  510. 25:03Okay. So I can create my database model
  511. 25:05by like const mongus is equals to
  512. 25:08require mongus and then I write my uh
  513. 25:11schema name con schema is equals to new
  514. 25:15mongus dot schema and then I in the then
  515. 25:19inside that object we write name is
  516. 25:21equals to type string then age is equals
  517. 25:24to type number and after that I write my
  518. 25:28like con my model schema is equals to
  519. 25:30mongus domodel and then I write my
  520. 25:32database name sorry collection name
  521. 25:35collection and then I pass my mongu
  522. 25:38schema and after that I module.exports
  523. 25:40exports that and I use it in our other
  524. 25:43like my API files to handle like CRUD
  525. 25:46operations.
  526. 25:48So why we use mongos? Why we not using
  527. 25:51like core MongoDB?
  528. 25:54Sir code we don't use like code MongoDB
  529. 25:57because if because for because like if
  530. 26:00you use that sir then it will be stored
  531. 26:02in our it will be stored in our like
  532. 26:05local uh local PC only. So when we want
  533. 26:08to like uh work in a in a in in a
  534. 26:12dynamic nature at that time we have to
  535. 26:14use it MongoDB atlas. Okay. MongoDB
  536. 26:17Atlas. Yeah.
  537. 26:20Okay. So what is cluster in NodeJS? Yeah
  538. 26:25sir. So cluster is a very very useful
  539. 26:28thing in NodeJS. So in the cluster it is
  540. 26:31used for to create child process for
  541. 26:33handling our uh our work uh for handling
  542. 26:38handling the work process uh in no in
  543. 26:41the in the back end we use the cluster
  544. 26:43module. So it optimizes our application
  545. 26:46and for that we use cluster module. So
  546. 26:49it creates child process uh running on a
  547. 26:52single parent process. Okay. So have you
  548. 26:55implement the search functionality with
  549. 26:57NodeJS and MongoDB database? Yeah, I
  550. 27:00have implemented search functionality. I
  551. 27:02have in fact I have implemented with
  552. 27:03MongoD with the back end as well as in
  553. 27:05the front end also. So give me example
  554. 27:08in back end. So in the back end okay so
  555. 27:12suppose like in the front end I have my
  556. 27:14API call and on the onchain event I'm
  557. 27:17firing that API. So and in the back
  558. 27:20end and I'm sending that data which we
  559. 27:25want to search as a query parameter. So
  560. 27:27in the back end I have my I have my API
  561. 27:30I have my simple API and inside that
  562. 27:32like I I'm getting that query parameter.
  563. 27:35Okay. And then like uh and then I am and
  564. 27:39then I'm like con uh uh const find data
  565. 27:44is equals uh con data is equals to await
  566. 27:48uh find by id or something find find one
  567. 27:51and then we pass that data and then we
  568. 27:54like send it to the back end. Okay.
  569. 27:58Okay. So uh sir then it it's like in a
  570. 28:01like continuous. So to handle the to
  571. 28:04handle this we can use the debouncing
  572. 28:06feature in the front end. In that case
  573. 28:08like it will be good for the
  574. 28:09optimization of our application. So in
  575. 28:12search uh you use any method MongoDB.
  576. 28:17Yeah I use like find one find there are
  577. 28:20multiple methods as find one find by ID.
  578. 28:23So for that we need to like get regular
  579. 28:26expression you use in search. Sorry sir.
  580. 28:29Any regular expression?
  581. 28:32Regular expression for search MongoDB.
  582. 28:35Ah yeah yeah yeah sir I got it. Yeah we
  583. 28:38use something like uh con name is equals
  584. 28:42to something await and uh inside that
  585. 28:45yeah yeah we pass something we pass the
  586. 28:48object inside that inside that we
  587. 28:51something called reax we send. Mhm.
  588. 28:55Yeah, I I remember that we send
  589. 28:58something to count my all data
  590. 29:02then how can I
  591. 29:04uh sir there's a there is a method
  592. 29:07called await count documents our model
  593. 29:11name my model name dot count documents
  594. 29:14then it will give me how many data is
  595. 29:17present in my collection
  596. 29:20okay the count okay
  597. 29:23great so Okay VC. So that's it from my
  598. 29:28side. Uh if you have any question please
  599. 29:31tell me.
  600. 29:33Uh right now sir I don't have any
  601. 29:35question. Okay not an issue. I will get
  602. 29:38back to you. Okay. Okay. When you are
  603. 29:41selecting your first round then we will
  604. 29:44uh start your the next practical round.
  605. 29:47Okay. Okay.
  606. 29:50So sir like what will be there in the
  607. 29:51practical round? So any overview about
  608. 29:54that? Um I will give you like some task
  609. 29:58like how you can implement
  610. 30:00authentication email and
  611. 30:03and Okay. Okay. Okay. Thank you sir.
  612. 30:07Great. Okay. Bye.

About this transcript

This page contains the full transcript of node js interview | fresher | round - 1| node Js #nodejs #mernstack #javascript #interview by Harsh Pathak, generated from the public captions YouTube serves with the video. The transcript has 4,324 words across 612 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.