323. Working With module.exports
./math.js
module.exports = {
add: (a, b) => a + b,
PI: 3.14159
}
./app.js
const { add, PI } = require('./math')
console.log(add(2, 4));
console.log(PI);
324. Requiring A Directory
When requiring a directory, index.js file will be used in Node
325. Introducing NPM
NPM
- Node Package Manager
- A library of thousands of packages published by other developers that we can use for free
- A command-line tool to easily install and manage those packages in our Node projects
328. The All-important Package json
package.json
- A JSON file that has metadata about a package.
- It saves the author, license. dependencies, etc.
- "npm init" command to create a package.json file
329. Installing All Dependencies For A Project
- "npm install" command in a folder having a package.json file will install all dependencies enumerated in the package.json file automatically
'Web Development > Backend' 카테고리의 다른 글
31. Our First Brush With Node (0) | 2022.01.27 |
---|
댓글