node.js - basic

This commit is contained in:
haerong22
2022-04-12 00:15:05 +09:00
parent ef6ebca959
commit 8095c43d5e
12 changed files with 58 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
const randomColor = require('randomcolor');
console.log(randomColor());

28
nodejs/package-example/package-lock.json generated Normal file
View File

@@ -0,0 +1,28 @@
{
"name": "package-example",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "package-example",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"randomcolor": "^0.6.2"
}
},
"node_modules/randomcolor": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/randomcolor/-/randomcolor-0.6.2.tgz",
"integrity": "sha512-Mn6TbyYpFgwFuQ8KJKqf3bqqY9O1y37/0jgSK/61PUxV4QfIMv0+K2ioq8DfOjkBslcjwSzRfIDEXfzA9aCx7A=="
}
},
"dependencies": {
"randomcolor": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/randomcolor/-/randomcolor-0.6.2.tgz",
"integrity": "sha512-Mn6TbyYpFgwFuQ8KJKqf3bqqY9O1y37/0jgSK/61PUxV4QfIMv0+K2ioq8DfOjkBslcjwSzRfIDEXfzA9aCx7A=="
}
}
}

View File

@@ -0,0 +1,15 @@
{
"name": "package-example",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"randomcolor": "^0.6.2"
}
}

8
nodejs/practice2/calc.js Normal file
View File

@@ -0,0 +1,8 @@
const add = (a, b) => a + b;
const sub = (a, b) => a - b;
module.exports = {
moduleName: "calc module",
add: add,
sub: sub,
}

View File

@@ -0,0 +1,4 @@
const calc = require("./calc");
console.log(calc.add(3, 4));
console.log(calc.sub(10, 4));