MEAN Stack

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Closures

A closure is an inner function that has access to the outer (enclosing) function's variables—scope chain. The closure has three scope chains: it has access to its own scope (variables defined between its curly brackets), it has access to the outer function's variables, and it has access to the global variables.

how a MEAN/MERN stack application is different from java or dotnet application

Java/DotNet Application --Front html/javascript/jquery --Server: C#/Java - framework --Database: SQL/Oracle MEAN/ MERN Stack --Angular/React - javascript --Server/NodeAPI - javascript --MongoDB/Mongoose - javascript --Fast ()

What is the use of PUT verbs

PUT: Used to create a resource, or overwrite it. While you specify the resources new URL. The PUT method requests that the state of the target resource be created or replaced with the state defined by the representation enclosed in the request message payload

How do we access or load modules from one file to another/ What is requireJS

RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, but it can be used in other JavaScript environments Node.

Explain Routing in Express.js?

Routing is a mechanism used by frameworks to decide how a URL/endpoint is responded/handled by the server. Express provides an excellent way to handle applications routing. Below is basic code to handle routing in Express. var express = require('express') var app = express() // respond with "hello world" when a GET request is made to the homepage app.get('/', function (req, res) { res.send('hello world') });

How to install express?

Run below command to install express npm install express --save

Scope and Context

Scope pertains to the visibility of the variables, and context refers to the object within which a function is executed. Scope: In JavaScript, the scope is achieved through the use of functions. ... This is a scope in JavaScript. Context: It refers to the object within which a function is executed

Types (Data Type)

Six data types that are primitives: Boolean, Null, Undefined, Number, String, Symbol (new in ECMAScript 6) and Object a non-primitive data-type.

What is NPM install or NPM i

This command installs a package, and any packages that it depends on. npm install (with no args, in package dir) npm install [<@scope>/]<name> npm install [<@scope>/]<name>@<tag> npm install [<@scope>/]<name>@<version> npm install [<@scope>/]<name>@<version range>

What is the first argument we get in node js

callback funct.on The first argument of the callback is reserved for an error object. If an error occurred, it will be returned by the first err argument. The second argument of the callback is reserved for any successful response data.

How does javascript/node improves perfornmance, even after bing single threaded.

event loop c++ (40%) asynchornous/promises callback - context/scope/closure

Hoisting

is JS's default behavior of defining all the declarations at the top of the scope before code execution. One of the benefits of hoisting is that it enables us to call functions before they appear in the code. JavaScript only hoists declarations, not initializations

What is NPM

npm , short for Node Package Manager, is two things: first and foremost, it is an online repository for the publishing of open-source Node. js projects; second, it is a command-line utility for interacting with said repository that aids in package installation, version management, and dependency management

What is the difference a programme being run on browser or on node

the browser has a window as the core object node js server is faster than browser

Private Scope in javascript

understood

What is nodejs

v8 engine on the server-side javascript framework built upon google chrome v8 engine compiles on server side single-threaded non-blocking highly scalable system the concept of concurrency model - which is being deployed through the event loop mechanism c++, and uses machine core processors to give a non-blocking execution

What Is The Difference Between Nodejs, AJAX

asynchornous javascript and xml-promises, JQuery - library written over javascript, and manipulates

How to ensure NODE Application keeps running on server

PM2 is a process manager written specifically for Node apps and works perfectly with Express.

What is a module/ IIFE

(IIFE) is often used to group related functionality into a single object or module

What is the best use of global function to track your application.

- logger - user information - global data

What pkg we use for reading files in NODE js

- var fs = require('fs'); -Read files -Create files -Update files -Delete files -Rename files fs.appendFile() fs.open() fs.writeFile()

Event Loop

An event loop in Node.js handles all the asynchronous callbacks in an application. It is one of the most important aspects of Node.js and the reason behind Node.js have non-blocking I/O. Since Node.js is an event-driven language, you can easily attach a listener to an event and then when the event occurs the callback will be executed by the specific listener. Whenever functions like setTimeout, http.get, and fs.readFile are called, Node.js executed the event loop and then proceeds with the further code without waiting for the output. Once the entire operation is finished, Node.js receives the output and then executes the callback function. This is why all the callback functions are placed in a queue in a loop. Once the response is received, they are executed one by one.

what is bson

BSON is a serialization format encoding format for JSON mainly used for storing and accessing the documents whereas JSON is a human-readable standard file format mainly used for transmission of data in the form of key-value attribute pairs. ... BSON in fact in some cases uses more space than JSON.

call, apply and bind

Both set the context within a function to get the object properly. var person1 = {name: 'Marvin', age: 42, size: '2xM'}; var person2 = {name: 'Zaphod', age: 42000000000, size: '1xS'}; var person = {name: 'Marvin', age: 42, size: '2xM'}; var sayHello = function(){ alert('Hello, ' + this.name); }; var sayGoodbye = function(){ alert('Goodbye, ' + this.name); }; Using call() and apply() method we can use methods from different context to the current context. It is really helpful for code reusability and context binding. call(): is used to call a function with a given this value and arguments provided individually. apply(): is used to call a function with a given this value and arguments provided as an array.

What is CRUD Operation

Create, Read, Update, Delete These are the four basic functions of persistent storage. a CRUD application is one that utilizes forms to retrieve and return data from a database

what is express

Express.js is a Node.js web application server framework, designed for building single-page, multi-page, and hybrid web applications.

NAME any four verbs we use in API

Get, Put, Post and Delete, Options - preflight request, - 1. Options - GetUser, is present or not 2. Get - No/Call

ES5, ES6 and ESNext

In the last 6 years, developers have pretty much stuck to ES5, since it works in all modern browsers. We have ES6, also known as ES2015, but not every browser supports it yet. ... To put it simply, ESNext (or ES. Next) is the future version of ECMAScript which is yet to be released

What is a callback in javascript

NodeJs Programming Based callbacks

What are API

Micro Services One service is responsible for one stuff

Call Back Hell/Solutions

Modularise Call Backs Use Promises - Part of ES6 Use Decoupled Functions External library to resolve dependency

Call Back Hell -- most important

Modularise Call Backs Use Promises - Part of ES6 Use Decoupled Functions External library to resolve dependency

Explain Mongoose?

Mongoose is a MongoDB Object Data Modeling (ODM) library for MongoDB and NodeJS.It provides a straight-forward, schema-based solution to model your application data. It includes built-in typecasting, validation, query building, business logic hooks and more, out of the box.

Global variables in NODE

__dirname, which is the same as the path.dirname() function of the __filename, will give you the directory in which the executing file is located.

let and const

`const` is a signal that the identifier won't be reassigned. `let` is a signal that the variable may be reassigned, such as a counter in a loop, or a value swap in an algorithm. It also signals that the variable will be used only in the block it's defined in, which is not always the entire containing function.

What is MongoDB

a database where we insert data in a flat file format, we name them collection

How to make things globally accessible in node

global.myNumber; //Delclaration of the global variable - undefined global.myNumber = 5; //Global variable initialized to value 5. var myNumberSquared = global.myNumber * global.myNumber; //Using the global variable.

this

refers to the callees context

Arrow Functions

resolves this and easy to write


Kaugnay na mga set ng pag-aaral

Week 1- Introduction and Concept of Substance Use Disorders

View Set

Course 5 Sec. 7: Testing and Iterating

View Set

The Declaration of Independence and the Beginning of the American Revolution

View Set