Closed kitchen-boy closed 2 years ago
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
const generatePage = (userName, githubName) => Name: ${userName}, Github: ${githubName}
;
Name: ${userName} GitHub: ${githubName}
;
};const profileDataArgs = process.argv.slice(2, process.argv.length);
const name = profileDataArgs[0]; const github = profileDataArgs[1];*/
const [name, github] = profileDataArgs;
Completed a function that receives the command-line arguments and inserts them in a HTML template literal.
Next, output this string into a file that can be opened in the browser.
const fs = require('fs');
*The require statement is a built-in function that's globally available in Node.js. It allows the app.js file to access the fs module's functions through the fs assignment.
fs.writeFile()
fs.writeFile('index.html', generatePage(name, github), err => { if (err) throw err;
console.log('Portfolio complete! Check out index.html to see the output!'); });
module.exports = generatePage;
In order to use functions from one module inside another, we use the related statements
So, because we added the
Go to the
const generatePage = require('./src/page-template.js');
Description