{"id":165,"date":"2022-08-09T17:07:32","date_gmt":"2022-08-09T09:07:32","guid":{"rendered":"https:\/\/lmceric.top\/?p=165"},"modified":"2022-08-09T17:07:34","modified_gmt":"2022-08-09T09:07:34","slug":"node-js%e5%bc%82%e6%ad%a5%e8%af%b7%e6%b1%82%e5%a4%a7%e5%9d%91","status":"publish","type":"post","link":"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/","title":{"rendered":"node.js\u5f02\u6b65\u8bf7\u6c42\u5927\u5751"},"content":{"rendered":"\n<p>\u524d\u6bb5\u65f6\u95f4\u5199Node.js\u6267\u884cmysql\u7684\u65f6\u5019\u8e29\u4e86\u4e2a\u5927\u5751\uff0c\u5927\u6982\u5c31\u662fnodejs\u8bf7\u6c42Mysql\u6570\u636e\u8868\u4e2d\u7684\u6570\u636e\uff0c\u8fd4\u56de\u4ee5\u540e\uff0c\u5982\u679c\u5339\u914d\u6b63\u786e\u5c31\u5411\u53e6\u4e00\u4e2a\u6570\u636e\u8868\u4e2d\u5199\u6570\u636e\u3002<\/p>\n\n\n\n<p>Node.js express\u6846\u67b6\u7684\u4e00\u4e2aget\u8bf7\u6c42\u63a5\u53e3\uff0c\u5177\u4f53\u64cd\u4f5c\u662f\u4ece\u6570\u636e\u5e93\u4e2d\u68c0\u7d22\u9a8c\u8bc1\u7801\uff0c\u5982\u679c\u6b63\u786e\u5c31\u5f80\u53e6\u4e00\u4e2a\u6570\u636e\u8868\u4e2d\u5199\u5165\u6570\u636e<br>\u539f\u59cb\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">app.get('\/mailconfirm', function (req, res) {\n    const mail = req.query.mail;\n    const cap = req.query.cap;\n\n    var findmailsql = \"SELECT * FROM CAP WHERE MAIL='\" + mail + \"'\";\n    connection.query(findmailsql, function (err, result) {\n        if (err) {\n            console.log('[INSERT ERROR] - ', err.message);\n            return;\n        }\n        if (result == 0) {\n            res.send(eval('(' + '{\"status\":300,\"msg\":\"NO EMAIL\"}' + ')'));\n        } else {\n            let FindCapSql = \"SELECT * FROM `CAP` WHERE MAIL='\"+mail+\"' AND CAP=\"+cap;\n            \/\/= eval('(' + '{\"status\":300,\"msg\":\"CAP FALSE\"}' + ')');\n\n            connection.query(FindCapSql, function(err, result){\n                if (err) {\n                    console.log('[INSERT ERROR] - ', err.message);\n                    return;\n                }\n                if(result == 0){\n                    res.send(eval('(' + '{\"status\":300,\"msg\":\"CAP FALSE\"}' + ')'));\n                } else {\n                    console.log(result);\n                    let insertEmailSql = 'UPDATE USERS SET MAIL = ? WHERE USER_ID = ?';\n                    let insertEmailSqlValue = [mail, result.USER_ID];\n                    connection.query(insertEmailSql, insertEmailSqlValue, function (err, result) {\n                        if (err) {\n                            console.log('[UPDATE ERROR] - ', err.message);\n                            return;\n                        }\n                        console.log('test');\n                        ret = result;\n                        res.send(ret);\n                        return;\n                    })\n                }\n            })\n\n            \/*\n            for (let i = 0; i &lt; result.length; i++) {\n                if (result[i].CAP == cap) {\n                    let insertEmailSql = 'UPDATE USERS SET MAIL = ? WHERE USER_ID = ?';\n                    let insertEmailSqlValue = [mail, result[i].USER_ID];\n                    connection.query(insertEmailSql, insertEmailSqlValue, function (err, result) {\n                        if (err) {\n                            console.log('[UPDATE ERROR] - ', err.message);\n                            return;\n                        }\n                        console.log('test');\n                        ret = result;\n                        res.send(ret);\n                        return;\n                    })\n                }\n            }\n            console.log('test2');\n            \/\/console.log(result.length);*\/\n        }\n        \/\/res.send(ret);\n    })\n})<\/code><\/pre>\n\n\n\n<p>\u4e0a\u9762\u8fd9\u6bb5\u662f\u4fee\u6539\u540e\u7684\u4ee3\u7801\uff0c\u95ee\u9898\u590d\u73b0\u7684\u7ed3\u6784\u5927\u81f4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">for(let i=0; i&lt;10; i++){\n    if(result[i] === 'test'){\n        connection.query(sql, function(err, result){\n            console.log('1');\n        })\n    }\n}\nconsole.log('2');<\/code><\/pre>\n\n\n\n<p>\u4e0a\u8ff0\u4ee3\u7801\u8fd0\u884c\u4ee5\u540e\u5728\u8fdb\u5165for\u4ee5\u540e\uff0c\u7531\u4e8emysql\u8bf7\u6c42\u662f\u5f02\u6b65\u8bf7\u6c42\uff0c\u6267\u884c\u7684\u65f6\u5019\u63a7\u5236\u53f0\u8f93\u51fa&#8217;2&#8217;\u4f1a\u6bd4mysql\u8bf7\u6c42\u540e\u8f93\u51fa\u20181\u2019\u63d0\u524d\u6267\u884c\uff0c\u63a7\u5236\u53f0\u4f1a\u5148\u8f93\u51fa2\u518d\u8f93\u51fa1\u3002<\/p>\n\n\n\n<p>\u8fd9\u91cc\u6211\u60f3\u5230\u662f\u7528Promise\u91cd\u65b0\u5c06\u63a5\u53e3\u8fdb\u884c\u5305\u88c5\uff0c\u4f7f\u5f97\u53ef\u4ee5\u4f7f\u7528async\/await\u8fdb\u884c\u8c03\u7528\uff0c\u7b26\u5408\u540c\u6b65\u7684\u7f16\u7801\u4e60\u60ef<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"1promise\u5c01\u88c5\u63a5\u53e3\">1.promise\u5c01\u88c5\u63a5\u53e3<\/h2>\n\n\n\n<p>Promise \u901a\u5e38\u88ab\u5b9a\u4e49\u4e3a<strong>\u6700\u7ec8\u4f1a\u53d8\u4e3a\u53ef\u7528\u503c\u7684\u4ee3\u7406<\/strong>\u3002<\/p>\n\n\n\n<p>Promise \u662f\u4e00\u79cd\u5904\u7406\u5f02\u6b65\u4ee3\u7801\uff08\u800c\u4e0d\u4f1a\u9677\u5165<a href=\"http:\/\/callbackhell.com\/\">\u56de\u8c03\u5730\u72f1<\/a>\uff09\u7684\u65b9\u5f0f\u3002<\/p>\n\n\n\n<p>\u591a\u5e74\u6765\uff0cpromise \u5df2\u6210\u4e3a\u8bed\u8a00\u7684\u4e00\u90e8\u5206\uff08\u5728 ES2015 \u4e2d\u8fdb\u884c\u4e86\u6807\u51c6\u5316\u548c\u5f15\u5165\uff09\uff0c\u5e76\u4e14\u6700\u8fd1\u53d8\u5f97\u66f4\u52a0\u96c6\u6210\uff0c\u5728 ES2017 \u4e2d\u5177\u6709\u4e86&nbsp;<strong>async<\/strong>&nbsp;\u548c&nbsp;<strong>await<\/strong>\u3002<\/p>\n\n\n\n<p><strong>\u5f02\u6b65\u51fd\u6570<\/strong>&nbsp;\u5728\u5e95\u5c42\u4f7f\u7528\u4e86 promise\uff0c\u56e0\u6b64\u4e86\u89e3 promise \u7684\u5de5\u4f5c\u65b9\u5f0f\u662f\u4e86\u89e3&nbsp;<code>async<\/code>&nbsp;\u548c&nbsp;<code>await<\/code>&nbsp;\u7684\u57fa\u7840\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"11-promise-\u5982\u4f55\u8fd0\u4f5c\">1.1 Promise \u5982\u4f55\u8fd0\u4f5c<\/h3>\n\n\n\n<p>\u5f53 promise \u88ab\u8c03\u7528\u540e\uff0c\u5b83\u4f1a\u4ee5<strong>\u5904\u7406\u4e2d\u72b6\u6001<\/strong>\u5f00\u59cb\u3002 \u8fd9\u610f\u5473\u7740\u8c03\u7528\u7684\u51fd\u6570\u4f1a\u7ee7\u7eed\u6267\u884c\uff0c\u800c promise \u4ecd\u5904\u4e8e\u5904\u7406\u4e2d\u76f4\u5230\u89e3\u51b3\u4e3a\u6b62\uff0c\u4ece\u800c\u4e3a\u8c03\u7528\u7684\u51fd\u6570\u63d0\u4f9b\u6240\u8bf7\u6c42\u7684\u4efb\u4f55\u6570\u636e\u3002<\/p>\n\n\n\n<p>\u88ab\u521b\u5efa\u7684 promise \u6700\u7ec8\u4f1a\u4ee5<strong>\u88ab\u89e3\u51b3\u72b6\u6001<\/strong>\u6216<strong>\u88ab\u62d2\u7edd\u72b6\u6001<\/strong>\u7ed3\u675f\uff0c\u5e76\u5728\u5b8c\u6210\u65f6\u8c03\u7528\u76f8\u5e94\u7684\u56de\u8c03\u51fd\u6570\uff08\u4f20\u7ed9&nbsp;<code>then<\/code>&nbsp;\u548c&nbsp;<code>catch<\/code>\uff09\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><\/h3>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"13-promise\">1.3 Promise<\/h3>\n\n\n\n<p>Promise API \u516c\u5f00\u4e86\u4e00\u4e2a Promise \u6784\u9020\u51fd\u6570\uff0c\u53ef\u4ee5\u4f7f\u7528&nbsp;<code>new Promise()<\/code>&nbsp;\u5bf9\u5176\u8fdb\u884c\u521d\u59cb\u5316\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">let done = true\n\nconst isItDoneYet = new Promise((resolve, reject) =&gt; {\n  if (done) {\n    const workDone = '\u8fd9\u662f\u521b\u5efa\u7684\u4e1c\u897f'\n    resolve(workDone)\n  } else {\n    const why = '\u4ecd\u7136\u5728\u5904\u7406\u5176\u4ed6\u4e8b\u60c5'\n    reject(why)\n  }\n})<\/code><\/pre>\n\n\n\n<p>\u5982\u4f60\u6240\u89c1\uff0cpromise \u68c0\u67e5\u4e86&nbsp;<code>done<\/code>&nbsp;\u5168\u5c40\u5e38\u91cf\uff0c\u5982\u679c\u4e3a\u771f\uff0c\u5219 promise \u8fdb\u5165<strong>\u88ab\u89e3\u51b3<\/strong>\u72b6\u6001\uff08\u56e0\u4e3a\u8c03\u7528\u4e86&nbsp;<code>resolve<\/code>&nbsp;\u56de\u8c03\uff09\uff1b\u5426\u5219\uff0c\u5219\u6267\u884c&nbsp;<code>reject<\/code>&nbsp;\u56de\u8c03\uff08\u5c06 promise \u7f6e\u4e8e\u88ab\u62d2\u7edd\u72b6\u6001\uff09\u3002 \u5982\u679c\u5728\u6267\u884c\u8def\u5f84\u4e2d\u4ece\u672a\u8c03\u7528\u8fc7\u8fd9\u4e9b\u51fd\u6570\u4e4b\u4e00\uff0c\u5219 promise \u4f1a\u4fdd\u6301\u5904\u7406\u4e2d\u72b6\u6001\u3002<\/p>\n\n\n\n<p>\u4f7f\u7528&nbsp;<code>resolve<\/code>&nbsp;\u548c&nbsp;<code>reject<\/code>\uff0c\u53ef\u4ee5\u5411\u8c03\u7528\u8005\u4f20\u8fbe\u6700\u7ec8\u7684 promise \u72b6\u6001\u4ee5\u53ca\u8be5\u5982\u4f55\u5904\u7406\u3002 \u5728\u4e0a\u8ff0\u793a\u4f8b\u4e2d\uff0c\u53ea\u8fd4\u56de\u4e86\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u4f46\u662f\u5b83\u53ef\u4ee5\u662f\u4e00\u4e2a\u5bf9\u8c61\uff0c\u4e5f\u53ef\u4ee5\u4e3a&nbsp;<code>null<\/code>\u3002 \u7531\u4e8e\u5df2\u7ecf\u5728\u4e0a\u8ff0\u7684\u4ee3\u7801\u7247\u6bb5\u4e2d\u521b\u5efa\u4e86 promise\uff0c\u56e0\u6b64\u5b83\u5df2\u7ecf\u5f00\u59cb\u6267\u884c\u3002 \u8fd9\u5bf9\u4e86\u89e3\u4e0b\u9762\u7684<a href=\"http:\/\/nodejs.cn\/learn\/understanding-javascript-promises#consuming-a-promise\">\u6d88\u8d39 promise<\/a>&nbsp;\u7ae0\u8282\u5f88\u91cd\u8981\u3002<\/p>\n\n\n\n<p>\u4e00\u4e2a\u66f4\u5e38\u89c1\u7684\u793a\u4f8b\u662f\u4e00\u79cd\u88ab\u79f0\u4e3a Promisifying \u7684\u6280\u672f\u3002 \u8fd9\u9879\u6280\u672f\u80fd\u591f\u4f7f\u7528\u7ecf\u5178\u7684 JavaScript \u51fd\u6570\u6765\u63a5\u53d7\u56de\u8c03\u5e76\u4f7f\u5176\u8fd4\u56de promise\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const fs = require('fs')\n\nconst getFile = (fileName) =&gt; {\n  return new Promise((resolve, reject) =&gt; {\n    fs.readFile(fileName, (err, data) =&gt; {\n      if (err) {\n        reject(err)  \/\/ \u8c03\u7528 `reject` \u4f1a\u5bfc\u81f4 promise \u5931\u8d25\uff0c\u65e0\u8bba\u662f\u5426\u4f20\u5165\u9519\u8bef\u4f5c\u4e3a\u53c2\u6570\uff0c\n        return        \/\/ \u4e14\u4e0d\u518d\u8fdb\u884c\u4e0b\u53bb\u3002\n      }\n      resolve(data)\n    })\n  })\n}\n\ngetFile('\/etc\/passwd')\n.then(data =&gt; console.log(data))\n.catch(err =&gt; console.error(err))<\/code><\/pre>\n\n\n\n<p>\u73b0\u5728\uff0c\u770b\u770b\u5982\u4f55\u6d88\u8d39\u6216\u4f7f\u7528 promise\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">const isItDoneYet = new Promise(\/* ... \u5982\u4e0a\u6240\u8ff0 ... *\/)\n\/\/...\n\nconst checkIfItsDone = () =&gt; {\n  isItDoneYet\n    .then(ok =&gt; {\n      console.log(ok)\n    })\n    .catch(err =&gt; {\n      console.error(err)\n    })\n}<\/code><\/pre>\n\n\n\n<p>\u8fd0\u884c&nbsp;<code>checkIfItsDone()<\/code>&nbsp;\u4f1a\u6307\u5b9a\u5f53&nbsp;<code>isItDoneYet<\/code>&nbsp;promise \u88ab\u89e3\u51b3\uff08\u5728&nbsp;<code>then<\/code>&nbsp;\u8c03\u7528\u4e2d\uff09\u6216\u88ab\u62d2\u7edd\uff08\u5728&nbsp;<code>catch<\/code>&nbsp;\u8c03\u7528\u4e2d\uff09\u65f6\u6267\u884c\u7684\u51fd\u6570\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"14-\u89e3\u51b3\u95ee\u9898\">1.4 \u89e3\u51b3\u95ee\u9898<\/h3>\n\n\n\n<p>\u4f7f\u7528\u94fe\u5f0fpromise\u5904\u7406\u4e24\u6b21\u5f02\u6b65mysql\u8bf7\u6c42<\/p>\n\n\n\n<p>\u57fa\u7840\u7684mysql\u5f02\u6b65\u8c03\u7528\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">function ControlAPI_obj(data, callback){\n    var sqlObj = _structureAnalysis(data);\n    dataBaseControl(sqlObj[\"sql\"], sqlObj[\"value\"], (result)=&gt;{\n        if (result == null || result.length == 0) {\n            callback(null);\n        } else {\n            callback(result);\n        }\n    });\n};<\/code><\/pre>\n\n\n\n<p>\u5c06\u4e0a\u9762\u7684\u7ed3\u6784\u6539\u5199\u4e3a\u540c\u6b65\u8c03\u7528\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">\/\/ \u4f20\u5165\u5355\u6761SQL\u8bed\u53e5\nvar ControlAPI_obj_async = function(data) {\n    var sqlObj = _structureAnalysis(data);\n    return new Promise((resolved, rejected)=&gt;{\n        dataBaseControl(sqlObj[\"sql\"], sqlObj[\"value\"], (result)=&gt;{\n            if (result === null) {\n                rejected(null);\n            } else {\n                resolved(result);\n            }\n        });\n    });\n}\n\n\/\/ \u4f20\u5165\u591a\u6761SQL\u8bed\u53e5\nvar ControlAPI_objs_async = function(...vars) {\n    let len = vars.length;\n    let promiseList = [];\n    for(let i = 0; i &lt; len; i++){\n        let sqlObj = _structureAnalysis(vars[i]);\n        promiseList.push(new Promise((resolved, rejected)=&gt;{\n            dataBaseControl(sqlObj[\"sql\"], sqlObj[\"value\"], (result)=&gt;{\n                if (result === null) {\n                    rejected(null);\n                } else {\n                    resolved(result);\n                }\n            });\n        }));\n    }\n    return Promise.all(promiseList);<\/code><\/pre>\n\n\n\n<p>\u4f7f\u7528\u65b9\u6cd5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">\/\/ \u540c\u6b65\u5199\u6cd5\nasync function(...){\n    [...]\n    try {\n        let result_single = await ControlAPI_obj_async(obj1);\n        let result_multi = await ControlAPI_objs_async(obj1, obj2,...,objn);\n    } catch (error) {\n        \/\/ \u6355\u83b7await\u4e2dPromise\u7684reject\u7684\u6570\u636e\n    }\n    [...]\n}\n\/\/ \u5f02\u6b65\u5199\u6cd5\nfunction(...) {\n    ControlAPI_obj(data, (result) =&gt; {\n        \/\/ \u5bf9result\u8fdb\u884c\u64cd\u4f5c\n    })\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u6bb5\u65f6\u95f4\u5199Node.js\u6267\u884cmysql\u7684\u65f6\u5019\u8e29\u4e86\u4e2a&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/\">Continue reading<span class=\"screen-reader-text\">node.js\u5f02\u6b65\u8bf7\u6c42\u5927\u5751<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":166,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":""},"categories":[11],"tags":[32,16,7],"class_list":["post-165","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tec","tag-node-js","tag-web","tag-7","entry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>node.js\u5f02\u6b65\u8bf7\u6c42\u5927\u5751 - LMC\u7684\u4e2a\u4eba\u7ad9<\/title>\n<meta name=\"description\" content=\"\u524d\u6bb5\u65f6\u95f4\u5199Node.js\u6267\u884cmysql\u7684\u65f6\u5019\u8e29\u4e86\u4e2a\u5927\u5751\uff0c\u5927\u6982\u5c31\u662fnodejs\u8bf7\u6c42Mysql\u6570\u636e\u8868\u4e2d\u7684\u6570\u636e\uff0c\u8fd4\u56de\u4ee5\u540e\uff0c\u5982\u679c\u5339\u914d\u6b63\u786e\u5c31\u5411\u53e6\u4e00\u4e2a\u6570\u636e\u8868\u4e2d\u5199\u6570\u636e\u3002Node.js express\u6846\u67b6\u7684\u4e00\u4e2aget\u8bf7\u6c42\u63a5\u53e3\uff0c\u5177\u4f53\u64cd\u4f5c\u662f\u4ece\u6570\u636e\u5e93\u4e2d\u68c0\u7d22\u9a8c\u8bc1\u7801\uff0c\u5982\u679c\u6b63\u786e\u5c31\u5f80\u53e6\u4e00\u4e2a\u6570\u636e\u8868\u4e2d\u5199\u5165\u6570\u636e\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"node.js\u5f02\u6b65\u8bf7\u6c42\u5927\u5751 - LMC\u7684\u4e2a\u4eba\u7ad9\" \/>\n<meta property=\"og:url\" content=\"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/\" \/>\n<meta property=\"og:site_name\" content=\"LMC\u7684\u4e2a\u4eba\u7ad9\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-09T09:07:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-09T09:07:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/lmceric.top\/wp-content\/uploads\/2022\/08\/R-C.png\" \/>\n\t<meta property=\"og:image:width\" content=\"3875\" \/>\n\t<meta property=\"og:image:height\" content=\"2422\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"SimpleAstronaut\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"SimpleAstronaut\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/lmceric.top\\\/index.php\\\/2022\\\/08\\\/09\\\/165\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/lmceric.top\\\/index.php\\\/2022\\\/08\\\/09\\\/165\\\/\"},\"author\":{\"name\":\"SimpleAstronaut\",\"@id\":\"https:\\\/\\\/lmceric.top\\\/#\\\/schema\\\/person\\\/1edca9cfe5ff17dbe947c332a66ee539\"},\"headline\":\"node.js\u5f02\u6b65\u8bf7\u6c42\u5927\u5751\",\"datePublished\":\"2022-08-09T09:07:32+00:00\",\"dateModified\":\"2022-08-09T09:07:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/lmceric.top\\\/index.php\\\/2022\\\/08\\\/09\\\/165\\\/\"},\"wordCount\":84,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/lmceric.top\\\/index.php\\\/2022\\\/08\\\/09\\\/165\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/lmceric.top\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/R-C.png\",\"keywords\":[\"Node.js\",\"web\",\"\u4e92\u8054\u7f51\u6280\u672f\"],\"articleSection\":[\"\u6280\u672f\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/lmceric.top\\\/index.php\\\/2022\\\/08\\\/09\\\/165\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/lmceric.top\\\/index.php\\\/2022\\\/08\\\/09\\\/165\\\/\",\"url\":\"https:\\\/\\\/lmceric.top\\\/index.php\\\/2022\\\/08\\\/09\\\/165\\\/\",\"name\":\"node.js\u5f02\u6b65\u8bf7\u6c42\u5927\u5751 - LMC\u7684\u4e2a\u4eba\u7ad9\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/lmceric.top\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/lmceric.top\\\/index.php\\\/2022\\\/08\\\/09\\\/165\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/lmceric.top\\\/index.php\\\/2022\\\/08\\\/09\\\/165\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/lmceric.top\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/R-C.png\",\"datePublished\":\"2022-08-09T09:07:32+00:00\",\"dateModified\":\"2022-08-09T09:07:34+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/lmceric.top\\\/#\\\/schema\\\/person\\\/1edca9cfe5ff17dbe947c332a66ee539\"},\"description\":\"\u524d\u6bb5\u65f6\u95f4\u5199Node.js\u6267\u884cmysql\u7684\u65f6\u5019\u8e29\u4e86\u4e2a\u5927\u5751\uff0c\u5927\u6982\u5c31\u662fnodejs\u8bf7\u6c42Mysql\u6570\u636e\u8868\u4e2d\u7684\u6570\u636e\uff0c\u8fd4\u56de\u4ee5\u540e\uff0c\u5982\u679c\u5339\u914d\u6b63\u786e\u5c31\u5411\u53e6\u4e00\u4e2a\u6570\u636e\u8868\u4e2d\u5199\u6570\u636e\u3002Node.js express\u6846\u67b6\u7684\u4e00\u4e2aget\u8bf7\u6c42\u63a5\u53e3\uff0c\u5177\u4f53\u64cd\u4f5c\u662f\u4ece\u6570\u636e\u5e93\u4e2d\u68c0\u7d22\u9a8c\u8bc1\u7801\uff0c\u5982\u679c\u6b63\u786e\u5c31\u5f80\u53e6\u4e00\u4e2a\u6570\u636e\u8868\u4e2d\u5199\u5165\u6570\u636e\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/lmceric.top\\\/index.php\\\/2022\\\/08\\\/09\\\/165\\\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/lmceric.top\\\/index.php\\\/2022\\\/08\\\/09\\\/165\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/lmceric.top\\\/index.php\\\/2022\\\/08\\\/09\\\/165\\\/#primaryimage\",\"url\":\"https:\\\/\\\/lmceric.top\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/R-C.png\",\"contentUrl\":\"https:\\\/\\\/lmceric.top\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/R-C.png\",\"width\":3875,\"height\":2422},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/lmceric.top\\\/index.php\\\/2022\\\/08\\\/09\\\/165\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\\\/\\\/lmceric.top\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"node.js\u5f02\u6b65\u8bf7\u6c42\u5927\u5751\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/lmceric.top\\\/#website\",\"url\":\"https:\\\/\\\/lmceric.top\\\/\",\"name\":\"LMC\u7684\u4e2a\u4eba\u7ad9\",\"description\":\"\u5b64\u5e06\u8fdc\u5f71\u78a7\u7a7a\u5c3d\uff0c\u552f\u89c1\u957f\u6c5f\u5929\u9645\u6d41\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/lmceric.top\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/lmceric.top\\\/#\\\/schema\\\/person\\\/1edca9cfe5ff17dbe947c332a66ee539\",\"name\":\"SimpleAstronaut\",\"sameAs\":[\"http:\\\/\\\/lmceric.top\"],\"url\":\"https:\\\/\\\/lmceric.top\\\/index.php\\\/author\\\/simpleastronaut\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"node.js\u5f02\u6b65\u8bf7\u6c42\u5927\u5751 - LMC\u7684\u4e2a\u4eba\u7ad9","description":"\u524d\u6bb5\u65f6\u95f4\u5199Node.js\u6267\u884cmysql\u7684\u65f6\u5019\u8e29\u4e86\u4e2a\u5927\u5751\uff0c\u5927\u6982\u5c31\u662fnodejs\u8bf7\u6c42Mysql\u6570\u636e\u8868\u4e2d\u7684\u6570\u636e\uff0c\u8fd4\u56de\u4ee5\u540e\uff0c\u5982\u679c\u5339\u914d\u6b63\u786e\u5c31\u5411\u53e6\u4e00\u4e2a\u6570\u636e\u8868\u4e2d\u5199\u6570\u636e\u3002Node.js express\u6846\u67b6\u7684\u4e00\u4e2aget\u8bf7\u6c42\u63a5\u53e3\uff0c\u5177\u4f53\u64cd\u4f5c\u662f\u4ece\u6570\u636e\u5e93\u4e2d\u68c0\u7d22\u9a8c\u8bc1\u7801\uff0c\u5982\u679c\u6b63\u786e\u5c31\u5f80\u53e6\u4e00\u4e2a\u6570\u636e\u8868\u4e2d\u5199\u5165\u6570\u636e","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/","og_locale":"zh_CN","og_type":"article","og_title":"node.js\u5f02\u6b65\u8bf7\u6c42\u5927\u5751 - LMC\u7684\u4e2a\u4eba\u7ad9","og_url":"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/","og_site_name":"LMC\u7684\u4e2a\u4eba\u7ad9","article_published_time":"2022-08-09T09:07:32+00:00","article_modified_time":"2022-08-09T09:07:34+00:00","og_image":[{"width":3875,"height":2422,"url":"https:\/\/lmceric.top\/wp-content\/uploads\/2022\/08\/R-C.png","type":"image\/png"}],"author":"SimpleAstronaut","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"SimpleAstronaut","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/#article","isPartOf":{"@id":"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/"},"author":{"name":"SimpleAstronaut","@id":"https:\/\/lmceric.top\/#\/schema\/person\/1edca9cfe5ff17dbe947c332a66ee539"},"headline":"node.js\u5f02\u6b65\u8bf7\u6c42\u5927\u5751","datePublished":"2022-08-09T09:07:32+00:00","dateModified":"2022-08-09T09:07:34+00:00","mainEntityOfPage":{"@id":"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/"},"wordCount":84,"commentCount":0,"image":{"@id":"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/#primaryimage"},"thumbnailUrl":"https:\/\/lmceric.top\/wp-content\/uploads\/2022\/08\/R-C.png","keywords":["Node.js","web","\u4e92\u8054\u7f51\u6280\u672f"],"articleSection":["\u6280\u672f"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/","url":"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/","name":"node.js\u5f02\u6b65\u8bf7\u6c42\u5927\u5751 - LMC\u7684\u4e2a\u4eba\u7ad9","isPartOf":{"@id":"https:\/\/lmceric.top\/#website"},"primaryImageOfPage":{"@id":"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/#primaryimage"},"image":{"@id":"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/#primaryimage"},"thumbnailUrl":"https:\/\/lmceric.top\/wp-content\/uploads\/2022\/08\/R-C.png","datePublished":"2022-08-09T09:07:32+00:00","dateModified":"2022-08-09T09:07:34+00:00","author":{"@id":"https:\/\/lmceric.top\/#\/schema\/person\/1edca9cfe5ff17dbe947c332a66ee539"},"description":"\u524d\u6bb5\u65f6\u95f4\u5199Node.js\u6267\u884cmysql\u7684\u65f6\u5019\u8e29\u4e86\u4e2a\u5927\u5751\uff0c\u5927\u6982\u5c31\u662fnodejs\u8bf7\u6c42Mysql\u6570\u636e\u8868\u4e2d\u7684\u6570\u636e\uff0c\u8fd4\u56de\u4ee5\u540e\uff0c\u5982\u679c\u5339\u914d\u6b63\u786e\u5c31\u5411\u53e6\u4e00\u4e2a\u6570\u636e\u8868\u4e2d\u5199\u6570\u636e\u3002Node.js express\u6846\u67b6\u7684\u4e00\u4e2aget\u8bf7\u6c42\u63a5\u53e3\uff0c\u5177\u4f53\u64cd\u4f5c\u662f\u4ece\u6570\u636e\u5e93\u4e2d\u68c0\u7d22\u9a8c\u8bc1\u7801\uff0c\u5982\u679c\u6b63\u786e\u5c31\u5f80\u53e6\u4e00\u4e2a\u6570\u636e\u8868\u4e2d\u5199\u5165\u6570\u636e","breadcrumb":{"@id":"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/#primaryimage","url":"https:\/\/lmceric.top\/wp-content\/uploads\/2022\/08\/R-C.png","contentUrl":"https:\/\/lmceric.top\/wp-content\/uploads\/2022\/08\/R-C.png","width":3875,"height":2422},{"@type":"BreadcrumbList","@id":"https:\/\/lmceric.top\/index.php\/2022\/08\/09\/165\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/lmceric.top\/"},{"@type":"ListItem","position":2,"name":"node.js\u5f02\u6b65\u8bf7\u6c42\u5927\u5751"}]},{"@type":"WebSite","@id":"https:\/\/lmceric.top\/#website","url":"https:\/\/lmceric.top\/","name":"LMC\u7684\u4e2a\u4eba\u7ad9","description":"\u5b64\u5e06\u8fdc\u5f71\u78a7\u7a7a\u5c3d\uff0c\u552f\u89c1\u957f\u6c5f\u5929\u9645\u6d41","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/lmceric.top\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/lmceric.top\/#\/schema\/person\/1edca9cfe5ff17dbe947c332a66ee539","name":"SimpleAstronaut","sameAs":["http:\/\/lmceric.top"],"url":"https:\/\/lmceric.top\/index.php\/author\/simpleastronaut\/"}]}},"jetpack_featured_media_url":"https:\/\/lmceric.top\/wp-content\/uploads\/2022\/08\/R-C.png","_links":{"self":[{"href":"https:\/\/lmceric.top\/index.php\/wp-json\/wp\/v2\/posts\/165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lmceric.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lmceric.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lmceric.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lmceric.top\/index.php\/wp-json\/wp\/v2\/comments?post=165"}],"version-history":[{"count":1,"href":"https:\/\/lmceric.top\/index.php\/wp-json\/wp\/v2\/posts\/165\/revisions"}],"predecessor-version":[{"id":167,"href":"https:\/\/lmceric.top\/index.php\/wp-json\/wp\/v2\/posts\/165\/revisions\/167"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lmceric.top\/index.php\/wp-json\/wp\/v2\/media\/166"}],"wp:attachment":[{"href":"https:\/\/lmceric.top\/index.php\/wp-json\/wp\/v2\/media?parent=165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lmceric.top\/index.php\/wp-json\/wp\/v2\/categories?post=165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lmceric.top\/index.php\/wp-json\/wp\/v2\/tags?post=165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}