- Explain the origin of Node.js from V8.
- ECMA is specs and V8 is implementation of that specs. In 4-5 sentences, explains this as easy to understand as talking to a 10 years old child.
- One key thing in design that makes Node.js popular is Node.js is an event driven and non-blocking I/O. In 4-5 sentences, explains this concept.
- Install Node.js to your local machine.
- Node.js can do quite many things. Read the official docs and the internet to:
- What does it mean when Express calling itself as "Fast, unopinionated, minimalist web framework for Node.js"?
- Create an HTTP server with Express
- Express middleware is a clever way to create separate logic to handle an HTTP request. Write 3 separate middlewares to:
- 1st authentication: check if the request payload has secret key A. If yes, carry on to the next middleware. If no, reject the request with 403.
- 2nd role check: check if the request payload has role X to access this API. If yes, carry on to the next middelware. If no, reject the request with 403.
- 3rd response: wait for 2 seconds then return JSON { reward: here are your cookies } to the caller.
- AWS: use free tier (no cc required, no charge) to understand what popular services are and how to use them with Node.js: EC2, S3,…
- What is an HTTP/HTTPS server?
- An HTTP/HTTPS server basically can response to any kinds of request from client. Watch this short Nginx Server introduction and reference Nginx official docs, as well as the internet if needed to:
- install nginx to your local machine
- serve html content with your nginx
- serve images with your nginx
- serve videos with your nginx
- serve 404 with your nginx
- serve 301 with your nginx
- Nginx is known for its well performance. What is the one most important feature in Nginx design that makes it gains such reputation?
- What is a proxy server? Why do we need it? And why Nginx is usually used as a proxy server?
- Test is to put our function in different scenarios (mimicking real life use) to make sure the function behave correctly, ideally in any situation in real life.
- Tests help us to think ahead of time and predict what can happen with function inputs before shipping code. Hence, tests improve reliability and help to ship code with more confidence.
- use Jest to setup test environment and test functions.
- Use mock and jest object mock out external function calls to create more real life, sophisticated test cases.
- What are the similarities and differences between mock and jest object functions?