Test Questions Based on course at https://www.udemy.com/course/nodejs-mongodb-express
Final Project in Section #6
Creating a fully functional node application, that uses Express to run a web application. Connect to a MongoDB and using Node allow the frontend web application to access the Database items, full CRUD interaction.
- Create a web application using Express – output html file from public folder
- Setup a MongoDB in the cloud prep to connect using NodeJS
- Create and test insert into the database
- Setup Frontend web application
- Add DOM event listeners to trigger requests
- Generate visual response as HTML from the Node response object
- Update and create interactive list of database content CRUD
- Add HTML updates to send requests to database.
#1 Introduction to Installing and Setup of Node
Node is a lightweight framework developed on Chrome’s V8 engine that can be used for largeScale application development. It’s scalable because the server can respond in a non-blocking way.
Process object which is a global that provides information, and control over, the current Node.js process. Because its global it is always available to Node.js applications without using require()
npm registry contains packages, many of which are also Node modules, or contain Node module
- Demo how to setup your development environment setting up Editor
- Visual Studio Code as an Editor with ready terminal
- Creating your first Node File and running the code
- How Node Works and examples of simple node syntax
- Where you can find out more about Node with more examples.
- How to debug and output content into the terminal various command line and console outputs
- NodeJS programming language environment REPL Read Evaluate Print Loop
- Examples of Node
- Process Object – with examples
- What Node Packages and NPM
- Variables and the Data Types. How to declare variables and examples of different Data Types.
- Adding Comments to code
- How to create Objects and Array
- Use of conditions for logic, turthy and falsey. How to use the Ternary Operator.
- Examples of logic switch statement, and condition statement
- Use of Objects and objects with methods.
- Array and Object Values, iterating through the contents of each.
- Use of Template literals to set string values
- Global object in Node with the use of timeout
- How to Construct promises and Resolve and Reject Promises
Asynchrony, in computer programming, refers to the occurrence of events independent of the main program flow and ways to deal with such events. How to add callbacks that run once a stack is complete.
Covering Input Output which accesses anything outside the application. Once the application is started it will be loaded into the machine memory.
Coding Examples, and practice code outputting into the console when ready
Event Driven programming which makes Node.js fairly fast compared to other similar technologies. Once the application starts it initiates its variables, declares its functions and then waits for the event to occur.
The two types of API functions in Node.js, Asynchronous, non-blocking functions and Synchronous, blocking functions.
The differences difference between blocking and non-blocking calls in Node.js.
Node keeps an event loop, which monitors when a task gets completed, which would then fire the corresponding events. Node.js overcomes the problem of blocking of I/O operations by using the event loop instead of threads.
Recursive functions, Function that calls itself is called a recursive function – must have a condition to break the loop.
The EventEmitter module makes possible the communication and interaction between objects in Node. EventEmitter provides properties like on and emit. The on property is used to bind a function with the event and emit property is used to fire an event.
- How a callback works, Callback added to the background will run once stack is complete
- Use of setTimeout and how it works in the queue.
- Callback example Create a function that returns the results from another function
- Event Loop with an Example of a Recursive Function
- The three states of promises
- How to create promises and more promises examples
- Node process object
- Node Event EventEmitter
- how to setup events and trigger emit of events
#4 Node Modules
Each module in NodeJS has its own context and cannot interfere with other modules. Modules are like libraries that you can include into your application. Node.js has a set of built-in modules which you can use without any further installation like http, fs, path, and url.
You can create your own modules, and easily include them in your applications. Save them locally and use within your node application as needed. Perfect to separate functionality for your application. To make properties and methods available outside the module file use the keyword exports.
NPM hosts thousands of third party modules, free packages to download and use. A package in Node.js contains all the files you need for a module.
Debugging – The try…catch statement marks a block of statements to try and specifies a response should an exception be thrown.
- How you can create your own module locally
- Commonly used builtin modules like http, fs, path and url
- Using FS module to update file contents, delete files, create new files
- Getting file information including file size with fs.stat()
- Use of node package manager NPM explore some popular node packages.
- Use of package.json – adding and removing packages
- Node Package Manager Module lodash
- Node Buffers how to copy and slice buffer contents
- Debugging node use of Throw, try and catch
#5 Node Web Application with Express
Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. Explore how to setup a web application quickly with Express.
The arguments which are available to an Express JS route handler function are request (request Object), response (response Object) and optional Next which can pass control to one of the subsequent route handlers.
- How to setup express and output html into a localhost webpage
- How to Serve files from a static directory using Express
- Values that can be used in route filtering, pattern match and reg exp
- Route parameters with req.params
- Express Route with full CRUD Create Read Update Delete Methods
- Returning JSON response
- Use of bodyparser
- Sending data from a frontend form to node express to output into the terminal
- Returning a JSON response to the frontend from a frontend request
#6 MongoDB with Frontend web page interaction using Node and Express
The official MongoDB Node. js driver allows Node. js applications to connect to MongoDB and work with data. The driver features an asynchronous API which allows you to access method return values through Promises or specify callbacks to access them when communicating with MongoDB.
- How to setup a cloud base mongo Database to use in practice development
- Connecting to a mongoDB
- Use of mongoDB client in Node
- Checking a connection to the database
- How to connect to a MongoDB and select the collections, create collections
- How to output database collections to the frontend using Express and Node.
Creating a fully functional node application that uses Express to run a web application. Connect to a MongoDB and using Node allow the frontend web application to access the Database items, full CRUD interaction.