Complete the code to import the built-in 'fs' module in Node.js.
const fs = require('[1]');
The 'fs' module is used for file system operations. To use it, you import it with require('fs').
Complete the code to create a server using the built-in 'http' module.
const http = require('http'); const server = http.[1]((req, res) => { res.end('Hello'); });
The 'http' module's method to create a server is 'createServer'.
Fix the error in the code to read a file asynchronously using the 'fs' module.
const fs = require('fs'); fs.readFile('file.txt', '[1]', (err, data) => { if (err) throw err; console.log(data.toString()); });
The encoding option should be 'utf8' to read the file as a string.
Fill both blanks to import the 'path' module and join two paths.
const [1] = require('[2]'); const fullPath = path.join('folder', 'file.txt');
You import the 'path' module with require('path') and assign it to a variable, usually named 'path'.
Fill all three blanks to import the 'os' module, get the platform, and print it.
const [1] = require('[2]'); const platform = os.[3](); console.log(platform);
Import the 'os' module with require('os'). The method to get the platform is 'platform()'. The variable name is 'os'.