Module 1. NodeJS basics [2 hours theory]
• What is Node.JS?
• Node.JS features
• Multithreaded server request processing
• Node.JS request processing with event loop
• NPM package manager
o package.json
o package-lock.json
o NPM folders
o Semantic versioning in NPM
o NPM commands
o Nodemon
• CommonJS and ES2015 module systems
• Simple http server
• Simple http server returning JSON
Module 2. Express framework [2 hours theory, 3 hours practice]
• Minimal Express app
• MVC pattern
• Express routing
o Request params
o Request query
o App.route()
o Put router to separate module
o Response methods
• Pug template engine
o Loops in Pug
o Conditions and variables
o Each
o Template inheritance
o Block append/prepend
o Mixins
• Middleware
o What is middleware
o How to create your own middleware (example with logging)
o Middleware to work with sessions
o Body-parser to parse POST requests body
o Express structure with middleware
o Middleware to serve static files
o Restricting middleware to route
o Order of middleware calls
• Express in practice
• Rest approach
o MVC pattern with REST server
o REST requests to obtain data
o Creating data in REST
o Updating and deleting data in REST
o Returning data format, Content-Type and Accept headers
o REST API summary and use cases
o REST statelessness vs statefulness
o REST statelessness and scalability
o REST statelessness and reliability
• Using Express to create REST service
• Error handling in Express
o Default error handler
o Custom error class
• Practice: Implement REST service (keeping data in session) [2h]
Module 3. Async/await syntax. Working with file system. [1 hour theory, 1 hour practice]
• Async/await syntax
o Async/await syntax and parallel execution
o Exception processing with Async/await
o Loops with async/await
o Async/await in Express
• Working with files
o Reading from file
o Writing to the file
o Reading file with async/await syntax
o Low-level work with files
o Sync calls exception handling
o Async calls exception handling
o Listing files in folder
• Practice: Implement REST service (keeping data in files)
Module 4. Using MongoDB with NodeJS [1 hour theory, 2 hours practice]
• What is MongoDB?
• What is MongoDB good for?
• Impedance mismatch (object-oriented vs. relational)
• No impedance mismatch with MongoDB
• MongoDB vs. Relational database
o Inserting documents to MongoDB collection
o The problem: slow search in collections
o Solution: building indexes
• Finding documents in MongoDB
o Find: queries
o Find: projections
o Find: cursors
o How to implement paging
• Updating documents in MongoDB
o Update: replacing document
o Update: changing only part of the document with operators
• Using MongoDB with NodeJS
o Connecting to MongoDB from NodeJS server
o Reading data from MongoDB with Express
o Writing data to MongoDB with Express
o Deleting/updating data with Express
• Practice: Implement REST service (keeping data in MongoDB)