{"id":210,"date":"2015-10-20T11:41:29","date_gmt":"2015-10-20T02:41:29","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2015\/10\/20\/favorite-node-modules"},"modified":"2015-10-20T11:41:29","modified_gmt":"2015-10-20T02:41:29","slug":"favorite-node-modules","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2015\/10\/20\/favorite-node-modules\/","title":{"rendered":"\u30aa\u30b9\u30b9\u30e1node-modules"},"content":{"rendered":"

\u624b\u6307\u304c\u30ab\u30b5\u3064\u304d\u904e\u304e\u3066\u6307\u7d0b\u8a8d\u8a3c\u304c\u51fa\u6765\u306a\u3044\u5c0f\u98fc\u3067\u3059\u3002<\/p>\n

\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u958b\u767a\u306b\u304a\u3044\u3066\u30c7\u30d5\u30a1\u30af\u30c8\u30b9\u30bf\u30f3\u30c0\u30fc\u30c9\u3068\u306a\u3063\u305f\u611f\u306e\u3042\u308bnpm<\/code>\u306f\u3001
\nNode.js<\/code>\u30b3\u30df\u30e5\u30cb\u30c6\u30a3\u306b\u3088\u308b\u958b\u767a\u306e\u6d3b\u767a\u306a\u7121\u6570\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u7fa4\u304c\u3042\u308a\u3001Node.js<\/code>\u305d\u306e\u3082\u306e\u306e\u9b45\u529b\u306b\u5927\u304d\u304f\u8ca2\u732e\u3057\u3066\u3044\u307e\u3059\u3002
\n\u305d\u3053\u3067\u672c\u7a3f\u3067\u306f\u79c1\u306e\u6c17\u306b\u5165\u3063\u3066\u3044\u308bnpm<\/code>\u3092\u3001\u6d3b\u7528\u7bc4\u56f2\u3092\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u306b\u9650\u3089\u305a\u3044\u304f\u3064\u304b\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n

validator<\/h3>\n

validator<\/a><\/p>\n

\u4e0e\u3048\u3089\u308c\u305f\u6587\u5b57\u5217\u3092\u691c\u8a3c\u3057\u305f\u308a\u7121\u5bb3\u5316\u3057\u307e\u3059\u3002<\/p>\n

import validator from 'validator';\nconst inValidMail = 'test@test,com'\nconst dangerInput = '<script>alert("\u5b9f\u884c\u53ef\u80fd")<\/script>'\nconsole.log(validator.isEmail(inValidMail)); \/\/ false\nconsole.log(validator.escape(dangerInput)); \/\/ &lt;script&gt;alert(&quot;\u5b9f\u884c\u53ef\u80fd&quot;)&lt;&#x2F;script&gt;<\/code><\/pre>\n

escape-regexp<\/h3>\n

escape-regexp<\/a><\/p>\n

\u6b63\u898f\u8868\u73fe\u7528\u306b\u6587\u5b57\u5217\u3092\u30a8\u30b9\u30b1\u30fc\u30d7\u3057\u307e\u3059\u3002<\/p>\n

import escape from 'escape-regexp';\nconst dangerStr = '\u305d\u306e\u307e\u307e\u3067\u306f\/\u4f7f\u3048\u306a\u3044\/';\nconsole.log(escape(dangerStr)); \/\/ \u305d\u306e\u307e\u307e\u3067\u306f\/\u4f7f\u3048\u306a\u3044\/<\/code><\/pre>\n

uuid<\/h3>\n

uuid<\/a><\/p>\n

\u30e6\u30cb\u30fc\u30af\u306a\u6587\u5b57\u5217\u3092\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n

import uuid from 'uuid';\nconst mytoken = uuid.v1();\nconsole.log(mytoken); \/\/ 19943a60-7182-11e5-9c4f-3738ae6ba773<\/code><\/pre>\n

autolinker<\/h3>\n

autolinker<\/a><\/p>\n

\u4e0e\u3048\u305f\u6587\u5b57\u5217\u5185\u306eURL, \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9, Twitter\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u5224\u5225\u3057\u3066\u30ea\u30f3\u30af\u5316\u3057\u307e\u3059\u3002<\/p>\n

import Autolinker from 'autolinker';\nconst linkedText = Autolinker.link('\u30d1\u30c3\u30b1\u30fc\u30b8\u306eURL\u306fhttps:\/\/www.npmjs.com\/package\/autolinker\u3067\u3059');\nconsole.log(linkedText);\n\/\/ \u30d1\u30c3\u30b1\u30fc\u30b8\u306eURL\u306f<a href="https:\/\/www.npmjs.com\/package\/autolinker" target="_blank">npmjs.com\/package\/autolinker<\/a>\u3067\u3059<\/code><\/pre>\n

bcrypt<\/h3>\n

bcrypt<\/a><\/p>\n

\u4e3b\u306b\u30d1\u30b9\u30ef\u30fc\u30c9\u306a\u3069\u306e\u6697\u53f7\u5316\u306b\u7528\u3044\u308bbcrypt\u6697\u53f7\u5316\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3002
\n\u5b89\u5168\u6027\u3068\u6bd4\u4f8b\u3057\u3066\u51e6\u7406\u6642\u9593\u306f\u9577\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n

import bcrypt from 'bcryptjs'\nimport Promise from 'bluebird'\n\n\/\/ \u6697\u53f7\u5316\u6f14\u7b97\u306e\u56de\u6570 2\u306e10\u4e57\n\/\/ \u3053\u306e\u6570\u5b57\u306b\u6bd4\u4f8b\u3057\u3066\nconst SALT_WORK_FACTOR = 10;\n\n\/\/ \u540c\u671f\u51e6\u7406\u7528\u306eAPI\u3082\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u304c\u3001\n\/\/ \u6697\u53f7\u5316\u51e6\u7406\u306e\u91cd\u3055\u3092\u8003\u3048\u975e\u540c\u671f\u51e6\u7406\u3092\u63a1\u7528\u3057\u305f\nfunction generateSalt(rawPassword) {\n  return new Promise((resolve, reject)=> {\n    bcrypt.genSalt(SALT_WORK_FACTOR, (err, salt)=> {\n      if (err) {\n        return reject(err);\n      }\n      resolve({ rawPassword, salt });\n    });\n  });\n}\n\nfunction hashPassword({ rawPassword, salt }) {\n  return new Promise((resolve, reject)=> {\n    bcrypt.hash(rawPassword, salt, (err, hash)=> {\n      if (err) {\n        return reject(err);\n      }\n      resolve(hash);\n    });\n  });\n}\n\nfunction saveDB(hashedPassword) {\n  return new Promise((resolve, reject)=> {\n    \/\/ DB\u4fdd\u5b58\u306e\u51e6\u7406\n  });\n}\n\ngenerateSalt()\n.then(hashPassword)\n.then(saveDB)\n.finally(next);\n\n\/\/ \u5fa9\u5143\u3057\u3066\u691c\u8a3c\nfunction inspectionPassword(candidatePassword, hashedPassword) {\n  return new Promise((resolve, reject)=> {\n    bcrypt.compare(candidatePassword, hashedPassword, (err, isMatch)=> {\n      if (err) {\n        return reject(err);\n      }\n      resolve(isMatch);\n    });\n  });\n}<\/code><\/pre>\n

\u53c2\u8003: \u7b46\u8005\u306e\u958b\u767a\u74b0\u5883\u3067\u6697\u53f7\u5316\u90e8\u5206\u306e\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u3092SALT_WORK_FACTOR<\/code>\u5b9a\u6570\u306e\u5024\u3092\u5909\u3048\u3066\u8d70\u3089\u305b\u3066\u307f\u305f\u7d50\u679c<\/p>\n\n\n\n\n\n\n\n\n\n\n\n
SALT_WORK_FACTOR<\/th>\n\u30c6\u30b9\u30c8\u5b8c\u4e86\u307e\u3067\u306e\u6642\u9593<\/th>\n<\/tr>\n<\/thead>\n
10<\/td>\n273ms<\/td>\n<\/tr>\n
11<\/td>\n491ms<\/td>\n<\/tr>\n
12<\/td>\n992ms<\/td>\n<\/tr>\n
13<\/td>\n1876ms<\/td>\n<\/tr>\n
14<\/td>\n3742ms<\/td>\n<\/tr>\n
15<\/td>\n7613ms<\/td>\n<\/tr>\n
20<\/td>\n250873ms<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

levenshtein<\/h3>\n

levenshtein<\/a><\/p>\n

\uff12\u3064\u306e\u6587\u5b57\u5217\u9593\u306e\u8ddd\u96e2(\u5dee\u7570)\u3092\u7b97\u51fa\u3059\u308b\u30ec\u30fc\u30d9\u30f3\u30b7\u30e5\u30bf\u30a4\u30f3\u8ddd\u96e2\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<\/p>\n

import Levenshtein from 'levenshtein';\n\nconst baseString = 'Hello, world';\nconst diffString = 'Hey, world';\nconst l = new Levenshtein(baseString, diffString);\n\nconsole.log(l.distance); \/\/ 3\nconsole.log(l);\n\/*\n 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10 |11 |12\n---+---+---+---+---+---+---+---+---+---+---+---+---\n 1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10 |11\n---+---+---+---+---+---+---+---+---+---+---+---+---\n 2 | 1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10\n---+---+---+---+---+---+---+---+---+---+---+---+---\n 3 | 2 | 1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |10\n---+---+---+---+---+---+---+---+---+---+---+---+---\n 4 | 3 | 2 | 2 | 2 | 3 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n---+---+---+---+---+---+---+---+---+---+---+---+---\n 5 | 4 | 3 | 3 | 3 | 3 | 4 | 3 | 4 | 5 | 6 | 7 | 8\n---+---+---+---+---+---+---+---+---+---+---+---+---\n 6 | 5 | 4 | 4 | 4 | 4 | 4 | 4 | 3 | 4 | 5 | 6 | 7\n---+---+---+---+---+---+---+---+---+---+---+---+---\n 7 | 6 | 5 | 5 | 5 | 4 | 5 | 5 | 4 | 3 | 4 | 5 | 6\n---+---+---+---+---+---+---+---+---+---+---+---+---\n 8 | 7 | 6 | 6 | 6 | 5 | 5 | 6 | 5 | 4 | 3 | 4 | 5\n---+---+---+---+---+---+---+---+---+---+---+---+---\n 9 | 8 | 7 | 6 | 6 | 6 | 6 | 6 | 6 | 5 | 4 | 3 | 4\n---+---+---+---+---+---+---+---+---+---+---+---+---\n10 | 9 | 8 | 7 | 7 | 7 | 7 | 7 | 7 | 6 | 5 | 4 | 3\n*\/<\/code><\/pre>\n

scp<\/h3>\n

scp<\/a><\/p>\n

scp<\/code>\u30b3\u30de\u30f3\u30c9\u306e\u30e9\u30c3\u30d1\u30fc\u30e9\u30a4\u30d6\u30e9\u30ea\u3002
\n\u30bf\u30b9\u30af\u30e9\u30f3\u30ca\u30fc\u306b\u6df7\u305c\u8fbc\u3093\u3067\u9759\u7684\u30d5\u30a1\u30a4\u30eb\u306e\u751f\u6210<\/code>>\u30ea\u30e2\u30fc\u30c8\u306b\u30b3\u30d4\u30fc<\/code>\u3068\u3059\u308b\u3068\u7c21\u6613\u30c7\u30d7\u30ed\u30a4\u30c4\u30fc\u30eb\u3068\u3057\u3066\u4f7f\u3048\u307e\u3059\u3002<\/p>\n

import scp from 'scp';\nscp.send({\n    file : '.\/.build\/*',\n  host: 'myhost.com',\n  user: 'myhost',\n  port: 2222,\n  path: '\/',\n});<\/code><\/pre>\n

log4js<\/h3>\n

log4js<\/a><\/p>\n

\u30ed\u30b0\u51fa\u529b\u30e9\u30a4\u30d6\u30e9\u30ea\u3002
\n\u51fa\u529b\u306e\u30bf\u30a4\u30d7\u3092\u30b3\u30f3\u30bd\u30fc\u30eb\u3084\u30d5\u30a1\u30a4\u30eb\u306a\u3069\u304b\u3089\u9078\u629e\u3057\u305f\u308a\u3001\u51fa\u529b\u5148\u3092\u8a2d\u5b9a\u3057\u305f\u308a\u3067\u304d\u307e\u3059\u3002<\/p>\n

import log4js from 'log4js';\n\nconst configure = {\n  debug: {\n    type: 'console',\n    category: 'console',\n  },\n  warn: {\n    type: 'file',\n    category: 'file',\n    filename: `.\/file.log`,\n  },\n};\n\nlog4js.configure({\n  appenders: [\n    configure.debug,\n    configure.warn,\n  ],\n});\n\nconst consoleLogger = log4js.getLogger('console');\nconst fileLogger = log4js.getLogger('file');\n\nconsoleLogger.info('Hello, console log.'); \/\/ [2015-10-20 09:24:22.551] [INFO] console - Hello, console log.\nfileLogger.info('Hello, file log.'); \/\/ [2015-10-20 09:24:22.555] [INFO] file - Hello, file log.<\/code><\/pre>\n

cron<\/h3>\n

cron<\/a><\/p>\n

cron\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u3067\u5b9a\u671f\u7684\u306b\u5b9f\u884c\u3057\u305f\u3044\u95a2\u6570\u304c\u767b\u9332\u3067\u304d\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3002
\n\u901a\u5e38\u306eNode.js<\/code>\u30d7\u30ed\u30bb\u30b9\u306a\u306e\u3067\u3001\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u5b9f\u884c\u3059\u308b\u306b\u306f\u5225\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u306e\u4f75\u7528\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n

import { CronJob } from 'cron';\nconst everyMorning = '0 0 8 * * *';\n\nconst job = new Cronjob({\n  cronTime: everyMorning,\n  onTick() {\n    console.log('Good morning.');\n  },\n  start: false,\n});\n\njob.start();<\/code><\/pre>\n

keymirror<\/h3>\n

keymirror<\/a><\/p>\n

key\u3068value\u304c\u540c\u3058\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u4f5c\u308a\u307e\u3059\u3002
\nReact\/Flux<\/code>\u306e
example<\/a>\u3067\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059\u304c\u3001
\nbabel<\/code>\u3067\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u304c\u5897\u3048\u305f\u6700\u8fd1\u3067\u306f\u4f7f\u3046\u6a5f\u4f1a\u306f\u5c11\u306a\u304f\u306a\u3063\u3066\u304d\u3066\u3044\u307e\u3059\u3002<\/p>\n

import keymirror from 'keymirror';\nconst myObj = keymirror({\n  foo: null,\n  bar: null,\n});\nconsole.log(myObj); \/\/ { foo: 'foo', bar: 'bar' }\n\n\/\/ bable\u7d4c\u7531\u3067\u306f\u3053\u3046\u66f8\u3051\u308b\nconst foo = 'foo';\nconst bar = 'bar';\nconst es2015Obj = {\n  foo,\n  bar,\n};\nconsole.log(es2015Obj); \/\/ { foo: 'foo', bar: 'bar' }<\/code><\/pre>\n

object-assign<\/h3>\n

object-assign<\/a><\/p>\n

ES2015\u306eObject.assign<\/code>\u30e1\u30bd\u30c3\u30c9\u306e\u5148\u53d6\u308a\u5b9f\u88c5\u3002
\n\u3053\u308c\u3082keymirror<\/code>\u3068\u540c\u69d8\u306e\u7406\u7531\u3067\u3001\u6700\u8fd1\u306f\u4f7f\u3046\u6a5f\u4f1a\u304c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n

import objectAssign from 'object-assign';\nconst objA = {\n  foo: 'foo',\n};\nconst objB = {\n  bar: 'bar',\n};\nconsole.log(objectAssign(objA, objB)); \/\/ { foo: 'foo', bar: 'bar' }\nconsole.log(Object.assign(objA, objB)); \/\/ { foo: 'foo', bar: 'bar' }<\/code><\/pre>\n

q<\/h3>\n

q<\/a><\/p>\n

callback\u5730\u7344\u306b\u9665\u3089\u306a\u3044\u305f\u3081\u306ePromise\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u4e00\u3064\u3002
\n\u5f8c\u8ff0\u306ebluebird<\/code>\u3068\u4e26\u3093\u30672\u5927\u4eba\u6c17Promise\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u3044\u3046\u5370\u8c61\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n

import fs from 'fs';\nimport Q from 'q';\n\nfunction readAsync(pathtofile) {\n  const deffered = Q.defer();\n  fs.readFile(pathtofile, (err, data)=> {\n    if (err) {\n      return deffered.reject(err);\n    }\n    deffered.resolve(data);\n  });\n  return deffered.promise;\n}\n\nreadAsync('README.md').then((data)=> {\n  console.log(`data: ${data}`);\n});<\/code><\/pre>\n

bluebird<\/h3>\n

bluebird<\/a><\/p>\n

Q<\/code>\u3068\u4e26\u3093\u3067\u4eba\u6c17\u306ePromise\u30e9\u30a4\u30d6\u30e9\u30ea\u3002
\n\u500b\u4eba\u7684\u306a\u5370\u8c61\u3068\u3057\u3066\u306f\u3053\u3061\u3089\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306e\u65b9\u304c\u76f4\u611f\u7684\u306b\u4f7f\u3044\u3084\u3059\u3044\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u3002
\n\u307e\u305f\u3001Node.js<\/code>\u30b9\u30bf\u30a4\u30eb\u306e\u95a2\u6570\u3092Promise\u5316\u3057\u3066\u304f\u308c\u308bPromise.promisify<\/code>\u30e1\u30bd\u30c3\u30c9\u304c\u975e\u5e38\u306b\u6709\u7528\u3067\u3001\u7b46\u8005\u306f\u4e3b\u306b\u3053\u3061\u3089\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n

import fs from 'fs';\nimport Promise from 'bluebird';\n\nfunction readAsync(pathtofile) {\n  return new Promise((resolve, reject)=> {\n    fs.readFile(pathtofile, (err, data)=> {\n      if (err) {\n        return reject(err);\n      }\n      resolve(data);\n    });\n  });\n}\n\nreadAsync('README.md').then((data)=> {\n  console.log(`data: ${data}`);\n});\n\n\/\/ Promise\u914d\u5217\u3092\u540c\u6642\u306b\u51e6\u7406\u3057\u305f\u308a\n\nPromise.all([readAsync('README-1.md'), readAsync('README-2.md'), readAsync('README-3.md')])\n.then((datas)=> {\n  console.log(`datas: ${datas}`);\n});\n\n\/\/ \u9806\u756a\u306b\u975e\u540c\u671f\u51e6\u7406\u3092\u5b9f\u884c\u3057\u305f\u308a\u3067\u304d\u308b\nfunction readAsyncReduce(_, pathtofile) {\n  return new Promise((resolve, reject)=> {\n    fs.readFile(pathtofile, (err, data)=> {\n      if (err) {\n        return reject(err);\n      }\n      console.log(`${pathtofile}: data`);\n      resolve();\n    });\n  });\n}\n\nPromise.reduce(['README-1.md', 'README-2.md', 'README-3.md'], readAsyncReduce, null)\n.then(()=> {\n  console.log('all done.');\n});\n\n\/\/ \u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u306e\u7b2c\u4e00\u5f15\u6570\u306b\u30a8\u30e9\u30fc\u3001\u7b2c\u4e8c\u5f15\u6570\u306b\u51e6\u7406\u7d50\u679c\u3092\u6e21\u3059\u95a2\u6570\u3092Promise\u5316\u3057\u3066\u304f\u308c\u308b\nconst readPromisify = Promise.promisify(fs.readFile);\n\nreadPromisify('README.md', 'utf-8')\n.then((data)=> {\n  console.log(data);\n});<\/code><\/pre>\n

sequelize<\/h3>\n

sequelize<\/a><\/p>\n

SQL\u7cfb\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306eORM\u30e9\u30a4\u30d6\u30e9\u30ea\u3002
\n\u7b46\u8005\u306fMySQL, PostgreSQL<\/code>\u3067\u3057\u304b\u6d3b\u7528\u3057\u305f\u3053\u3068\u304c\u3042\u308a\u307e\u305b\u3093\u304c\u3001<\/p>\n

\n

Sequelize is a promise-based Node.js\/io.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server.<\/p>\n<\/blockquote>\n

\u3068\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n

\/\/ MySQL\u3067\u306e\u4f8b\nimport Sequelize from 'sequelize';\n\nconst db = 'mysql:\/\/username:password@127.0.0.1:3306\/databasename';\nconst connection = new Sequelize(db);\n\nconst UserModel = connection.define('user', {\n    mail: {\n      type: Sequelize.STRING,\n      field: 'mail',\n      unique: true,\n      validate: {\n        isEmail: true\n      },\n    },\n    password: {\n      type: Sequelize.STRING,\n      field: 'password',\n    },\n  },\n);\n\nUserModel.create({\n  mail: 'my-mail@test.com',\n  password: 'mypassword',\n})\n.then((newUser)=> {\n  console.log('user saved.');\n});<\/code><\/pre>\n

mongoose<\/h3>\n

mongoose<\/a><\/p>\n

MongoDB\u306eORM\u30e9\u30a4\u30d6\u30e9\u30ea\u3002<\/p>\n

import mongoose from 'mongoose';\n\nconst db = 'mongodb:\/\/username:password@127.0.0.1:27017\/databasename';\nconst connection = mongoose.createConnection(db);\nconst UserSchema = new mongoose.Schema({\n  mail: {\n    type: String,\n    index: {\n      unique: true,\n    },\n  },\n  password: String,\n});\nconst UserModel = db.model('user', UserSchema);\n\nconst newUser = new User({\n  mail: 'my-mail@test.com',\n  password: 'mypassword',\n});\n\nnewUser.save((err)=> {\n  console.log('user saved.');\n});<\/code><\/pre>\n

\u307e\u3068\u3081<\/h2>\n

\u3044\u304f\u3064\u304b\u99c6\u3051\u8db3\u3067\u7d39\u4ecb\u3057\u3066\u307f\u307e\u3057\u305f\u304c\u3044\u304b\u304c\u3060\u3063\u305f\u3067\u3057\u3087\u3046\u304b\u3002
\n\u53c2\u8003\u306b\u306a\u308c\u3070\u3046\u308c\u3057\u3044\u3067\u3059\u3002<\/p>\n

Node\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u6d3b\u7528\u3057\u305f\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a<\/a>\u3092\u3054\u691c\u8a0e\u306e\u4f01\u696d\u69d8\u306f\u3001\u662f\u975eMMM\u306b\u3054\u76f8\u8ac7\u4e0b\u3055\u3044\u307e\u305b\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

\u624b\u6307\u304c\u30ab\u30b5\u3064\u304d\u904e\u304e\u3066\u6307\u7d0b\u8a8d\u8a3c\u304c\u51fa\u6765\u306a\u3044\u5c0f\u98fc\u3067\u3059\u3002 \u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u958b\u767a\u306b\u304a\u3044\u3066\u30c7\u30d5\u30a1\u30af\u30c8\u30b9\u30bf\u30f3\u30c0\u30fc\u30c9\u3068\u306a\u3063\u305f\u611f\u306e\u3042\u308bnpm\u306f\u3001 Node.js\u30b3\u30df\u30e5\u30cb\u30c6\u30a3\u306b\u3088\u308b\u958b\u767a\u306e\u6d3b\u767a\u306a\u7121\u6570\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u7fa4\u304c\u3042\u308a\u3001Node.js\u305d\u306e\u3082\u306e\u306e\u9b45\u529b\u306b\u5927\u304d\u304f\u8ca2\u732e\u3057\u3066\u3044\u307e\u3059\u3002 \u305d\u3053\u3067\u672c\u7a3f\u3067\u306f\u79c1\u306e\u6c17\u306b\u5165\u3063\u3066\u3044\u308bnpm\u3092\u3001\u6d3b\u7528\u7bc4\u56f2\u3092\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u306b\u9650\u3089\u305a\u3044\u304f\u3064\u304b\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002 validator validator \u4e0e\u3048\u3089\u308c\u305f\u6587 […]<\/p>\n","protected":false},"author":1,"featured_media":826,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[77,28],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/210"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=210"}],"version-history":[{"count":0,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/210\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media\/826"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}