{"id":161318,"date":"2020-09-09T14:53:55","date_gmt":"2020-09-09T06:53:55","guid":{"rendered":"http:\/\/4563.org\/?p=161318"},"modified":"2020-09-09T14:53:55","modified_gmt":"2020-09-09T06:53:55","slug":"%e4%b8%89%e6%ad%a5%e5%b8%a6%e4%bd%a0%e5%bc%80%e5%8f%91%e4%b8%80%e4%b8%aa%e7%9f%ad%e9%93%be%e6%8e%a5%e7%94%9f%e6%88%90%e5%b9%b3%e5%8f%b0","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=161318","title":{"rendered":"\u4e09\u6b65\u5e26\u4f60\u5f00\u53d1\u4e00\u4e2a\u77ed\u94fe\u63a5\u751f\u6210\u5e73\u53f0"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u4e09\u6b65\u5e26\u4f60\u5f00\u53d1\u4e00\u4e2a\u77ed\u94fe\u63a5\u751f\u6210\u5e73\u53f0               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : GrapeCityChina <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u524d\u7aef\u65f6\u95f4\u5728\u5f00\u53d1 [\u8461\u8404\u57ce\u793e\u533a] \u516c\u4f17\u53f7\u65f6\u6709\u4e00\u4e2a\u529f\u80fd\u662f\u9700\u8981\u7528\u7f51\u9875\u6388\u6743\u8ba4\u8bc1\u5730\u5740\u751f\u6210\u4e8c\u7ef4\u7801\uff0c\u4f46\u7c7b\u4f3c\u50cf\u4e0b\u9762\u8fd9\u6837\u7684 Url \u5373\u4fbf\u662f\u770b\u4e5f\u89c9\u5f97\u5f88\u5934\u75bc\u4e86 https:\/\/open.weixin.qq.com\/connect\/oauth2\/authorize?appid=xxxxxxxxxxxxxxxxxx&amp;redirect_uri=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE&amp;connect_redirect=1#wechat_redirect<\/p>\n<p>\u7528\u8fd9\u4e2a\u5730\u5740\u751f\u6210\u7684\u4e8c\u7ef4\u7801\u4e5f\u662f\u5bc6\u5bc6\u9ebb\u9ebb\uff0c\u867d\u4e0d\u5f71\u54cd\u5fae\u4fe1\u957f\u6309\u626b\u7801\uff0c\u4e00\u65e6\u4e8c\u7ef4\u7801\u5c3a\u5bf8\u7f29\u4e00\u70b9\u70b9\uff0c\u56fe\u7247\u9a6c\u4e0a\u5c31\u4f1a\u7cca\u6389\uff0c\u5bfc\u81f4\u6444\u50cf\u5934\u76f4\u63a5\u626b\u7801\u4f1a\u96be\u4ee5\u8bc6\u522b\u3002<\/p>\n<p>\u90a3\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c \u6211\u4eec\u81ea\u7136\u5c31\u4f1a\u60f3\u5230\u5982\u679c\u4f7f\u7528\u77ed\u94fe\u63a5\u51cf\u5c11 url \u7684\u5b57\u7b26\uff0c\u751f\u6210\u7684\u7801\u81ea\u7136\u5c31\u4f1a\u53d8\u5f97\u5bb9\u6613\u8bc6\u522b\u4e86\uff0c\u540c\u65f6\u8fd8\u4f1a\u4f7f url \u66f4\u7f8e\u89c2\u4e14\u6613\u4e8e\u8f6c\u53d1\u3002\u73b0\u5728\u5e02\u9762\u4e0a\u53ef\u7528\u7684\u5c31\u662f\u5fae\u535a\u7684 t.cn \u548c\u4e00\u4e9b\u7b2c\u4e09\u65b9\u7684\u751f\u6210\u77ed\u94fe\u63a5\u5de5\u5177\uff0c\u4f46\u8fd9\u4e24\u7c7b\u5de5\u5177\u90fd\u6709\u4e00\u4e9b\u4f7f\u7528\u4e0a\u7684\u95ee\u9898\uff0c\u4f8b\u5982\uff1at.cn \u73b0\u5728\u7684\u89c4\u5219\u662f\u4f1a\u51fa\u73b0\u4e00\u4e2a\u4e2d\u8f6c\u9875\u4e0d\u4f1a\u76f4\u63a5\u8df3\u8f6c\uff0c\u800c\u7b2c\u4e09\u65b9\u7684\u5de5\u5177\u56e0\u4e3a\u662f\u4e00\u4e2a\u516c\u5171\u5e73\u53f0\uff0c\u6709\u65f6\u53ef\u80fd\u4f1a\u56e0\u4e00\u4e9b\u4e0d\u826f\u4fe1\u606f\u5bfc\u81f4\u6574\u4e2a\u5e73\u53f0\u65e0\u6cd5\u8bbf\u95ee\u3002<\/p>\n<p>\u90a3\u4e0e\u5176\u8fd9\u6837\uff0c\u4e0d\u5982\u6211\u4eec\u81ea\u5df1\u6765\u5b9e\u73b0\u4e00\u4e2a\u77ed\u94fe\u63a5\u5e73\u53f0\u5427\uff0c\u5b9e\u73b0\u4e00\u4e2a\u77ed\u94fe\u63a5\u5e73\u53f0\u539f\u7406\u4e0a\u4e5f\u975e\u5e38\u7b80\u5355\uff0c\u641e\u5b9a\u4e24\u90e8\u5206\u5c31\u884c\u4e86\uff1a1.\u4fdd\u5b58\u957f\u77ed\u94fe\u63a5\u7684\u5bf9\u5e94\u5173\u7cfb\u30022.\u901a\u8fc7\u77ed\u94fe\u63a5\u67e5\u8be2\u957f\u8fde\u63a5\u5e76\u91cd\u5b9a\u5411\u3002<\/p>\n<p>\u4e3a\u4e86\u9ad8\u6548\uff0c\u6211\u8fd9\u4f7f\u7528\u7684\u662f node \u548c mongodb\uff0c\u4e0b\u9762\u6211\u4eec\u5c31\u6765\u5f00\u59cb\u52a8\u624b\u5427\u3002<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u5148\u521b\u5efa\u4e00\u4e2a express \u5de5\u7a0b<\/p>\n<p>express -e demo<\/p>\n<p>change directory: &gt; cd demo install dependencies: &gt; npm install run the app: &gt; SET DEBUG=demo:* &amp; npm start<\/p>\n<p>\u7136\u540e\u8fdb\u5165 demo \u76ee\u5f55\u5e76\u5b89\u88c5 express \u5fc5\u8981\u4f9d\u8d56<\/p>\n<p>npm install<\/p>\n<p>\u540c\u65f6\u901a\u8fc7 npm \u5b89\u88c5\u6211\u4eec\u9700\u8981\u7528\u5230\u7684 mongoose \u548c shortid \u548c body-parser<\/p>\n<p>npm install mongoose npm install shortid npm install body-parser<\/p>\n<p>\u4e0b\u9762\u5206\u522b\u5bf9\u4f7f\u7528\u5230\u7684\u8fd9\u4e09\u4e2a\u5305\u7b80\u5355\u8bf4\u660e\u4e00\u4e0b\uff1a<\/p>\n<ul>\n<li>\u5728\u8fd9\u4e2a\u5e94\u7528\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86 mongodb\uff0c\u4e4b\u6240\u4ee5\u9009\u62e9\u5b83\u662f\u56e0\u4e3a\u6267\u884c\u9ad8\u6548\u4e14\u4f4e\u5f00\u9500\uff0c\u6240\u4ee5\u6267\u884c\u8d77\u6765\u4e5f\u5f88\u9ad8\u6548\uff0c\u4e0d\u8fc7\u5982\u679c\u4f7f\u7528\u5176\u4ed6\u6570\u636e\u5e93\u4e5f\u662f\u6ca1\u95ee\u9898\u7684\u3002\u8fd9\u91cc\u7684<strong>mongoose<\/strong>\u5c31\u662f npm \u7684\u4e00\u4e2a\u5305\uff0c\u4e3b\u8981\u662f\u4e3a\u7a0b\u5e8f\u63d0\u4f9b\u8fde\u63a5 mongodb \u5e76\u589e\u5220\u67e5\u6539\u7684\u529f\u80fd\u3002<\/li>\n<li>\u901a\u8fc7\u4f7f\u7528<strong>shortid<\/strong>\u53ef\u4ee5\u751f\u6210\u4e00\u4e2a\u6307\u5b9a\u5b57\u7b26\u4e0d\u91cd\u590d\u7684\u7f16\u7801\uff0c\u4fbf\u4e8e\u6211\u4eec\u751f\u6210\u7c7b\u4f3c xxx.com\/ngTsfdgh \u7c7b\u4f3c\u7ea2\u5b57\u90e8\u5206\u7684\u7f16\u7801\u3002<\/li>\n<li>\u7531\u4e8e\u6211\u4eec\u751f\u6210\u77ed\u94fe\u63a5\u90e8\u5206\u7684 api \u4f7f\u7528\u7684\u662f post \u65b9\u6cd5\uff0c\u4f7f\u7528<strong>body-parser<\/strong>\u53ef\u4ee5\u591a\u6269\u5c55\u4e00\u79cd body \u7f16\u7801\u7c7b\u578b\u89e3\u6790\u80fd\u529b\u3002<\/li>\n<\/ul>\n<h2>\u9996\u5148\u8bbe\u7f6e MongoDB \u7684\u8fde\u63a5\u4fe1\u606f<\/h2>\n<p>module.exports = { mongo_base_connection_url: &#8216;mongodb:\/\/localhost:27017&#8217;, mongo_db: &#8216;mongodb:\/\/localhost:27017\/shorturl&#8217;, mongo_options: { autoReconnect: true, keepAlive: true, reconnectTries: 50, reconnectInterval: 1000, connectTimeoutMS: 5000000, } } console.log(&#8220;Connection local mongo db&#8221;);<\/p>\n<h2>\u6570\u636e\u5e93\u6a21\u578b\u5b9a\u4e49<\/h2>\n<p>\u56e0\u4e3a\u6211\u4eec\u7684\u5bf9\u5e94\u5173\u7cfb\u662f\u9700\u8981\u901a\u8fc7\u77ed\u94fe\u63a5\u67e5\u8be2\u957f\u8fde\u63a5\uff0c\u6240\u4ee5\u8fd9\u91cc\u6211\u4eec\u4e3b\u8981\u4ee5\u5b58\u50a8\u77ed\u94fe\u63a5\u548c\u957f\u8fde\u63a5\u4e3a\u4e3b\uff0c\u53e6\u5916\u5927\u5bb6\u4e5f\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u9700\u8981\u6dfb\u52a0\u94fe\u63a5\u70b9\u51fb\u7edf\u8ba1\u4e4b\u7c7b\u7684\u5b57\u6bb5\uff0c\u65b9\u4fbf\u540e\u671f\u7edf\u8ba1\u3002<\/p>\n<p>var mongoose = require(&#8216;mongoose&#8217;); var Schema = mongoose.Schema;<\/p>\n<p>var urlSchema = new Schema({ shortUrl: String, longUrl: String });<\/p>\n<p>module.exports = mongoose.model(&#8216;UrlTable&#8217;, urlSchema);<\/p>\n<h2>\u5b9a\u4e49 express \u8def\u7531<\/h2>\n<p>\u56e0\u4e3a\u8fd9\u4e2a\u5e94\u7528\u6211\u4eec\u53ea\u6709\u751f\u6210\u548c Redirect \u4e24\u4e2a\u529f\u80fd\uff0c\u6240\u4ee5\u8fd9\u91cc\u53ea\u6709\u4e24\u4e2a\u9875\u9762\u5373\u53ef\u5b8c\u6210\u6240\u6709\u5de5\u4f5c\u3002<\/p>\n<p>var index = require(&#8216;.\/routes\/index&#8217;); var url = require(&#8216;.\/routes\/url&#8217;); app.use(&#8216;\/&#8217;, index); app.use(&#8216;\/url&#8217;, url);<\/p>\n<h4>\u751f\u6210\u77ed\u94fe\u63a5\u9875\u9762<\/h4>\n<p>const express = require(&#8220;express&#8221;); const router = express.Router(); const shortId = require(&#8216;shortid&#8217;); const UrlTable = require(&#8216;..\/models\/urltable&#8217;); const mongoose = require(&#8216;mongoose&#8217;); var setup = require(&#8216;..\/dbconfig\/db&#8217;);<\/p>\n<p>router.post(&#8216;\/&#8217;, function(req, res, next) { var params = req.body; var url = params.longUrl; shortId.characters(&#8216; 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ^*&#8217;) var shortid = shortId.generate(); var objurl = { shortUrl: shortid, longUrl: url}; mongoose.connect(setup.mongo_db, setup.mongo_options); UrlTable.create(objurl, function (err, objurl) { \/\/if (err) console.log(err); res.send(&#8220;http:\/\/localhost:3000\/&#8221; + shortid); }); return; });<\/p>\n<p>\u6307\u5b9a\u751f\u6210 shortId \u5b57\u7b26\u7684\u8303\u56f4\u5e76\u751f\u6210\uff1a<\/p>\n<p>shortId.characters(&#8216;0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&#8217;)<\/p>\n<p>var shortid = shortId.generate();<\/p>\n<p>\u4e3a\u6570\u636e\u5e93\u6784\u5efa\u7b26\u5408\u8981\u6c42\u7684\u6570\u636e\u6a21\u578b\uff1a<\/p>\n<p>var objurl = { shortUrl: shortid, longUrl: url};<\/p>\n<p>\u6700\u540e\uff0c\u8fde\u63a5\u6570\u636e\u5e93\u5e76\u4fdd\u5b58\u540e\u5c06\u77ed\u94fe\u63a5\u7ed3\u679c\u8fd4\u56de\u5ba2\u6237\u7aef\uff1a<\/p>\n<p>mongoose.connect(setup.mongo_db, setup.mongo_options);<\/p>\n<p>UrlTable.create(objurl, function (err, objurl) {<\/p>\n<p>\/\/if (err) console.log(err);<\/p>\n<p>res.send(&#8220;http:\/\/localhost:3000\/&#8221; + shortid);<\/p>\n<p>});<\/p>\n<h4>\u77ed\u94fe\u63a5\u8df3\u8f6c\u9875\u9762<\/h4>\n<p>const express = require(&#8220;express&#8221;); const router = express.Router(); const UrlTable = require(&#8216;..\/models\/urltable&#8217;); const mongoose = require(&#8216;mongoose&#8217;); var setup = require(&#8216;..\/dbconfig\/db&#8217;);<\/p>\n<p>router.get(&#8216;\/:shortUrl&#8217;, function (req, res, next) { var shortUrl = req.params.shortUrl; mongoose.connect(setup.mongo_db, setup.mongo_options); UrlTable.findOne({ shortUrl:shortUrl }).then((result) =&gt; { \/\/\u5f85\u6dfb\u52a0\u9519\u8bef\u5904\u7406 res.redirect(result.longUrl); }) });<\/p>\n<p>module.exports = router;<\/p>\n<p>\u8fd9\u4e2a\u9875\u9762\u4e3a\u4e86\u4fbf\u4e8e\u5feb\u901f\u8df3\u8f6c\uff0c\u6211\u4eec\u5c31\u4f7f\u7528 get \u63a5\u6536\u53c2\u6570\uff0c\u8fd9\u4e2a\u9875\u9762\u529f\u80fd\u5c31\u5f88\u7b80\u5355\u4e86\uff0c\u63a5\u53c2\u67e5\u8be2\u5e76\u8df3\u8f6c\u3002<\/p>\n<p>\u63a5\u6536\u77ed\u94fe\u63a5\u7801<\/p>\n<p>var shortUrl = req.params.shortUrl;<\/p>\n<p>\u8fde\u63a5\u6570\u636e\u5e93\u67e5\u8be2\u5e76\u8df3\u8f6c<\/p>\n<p>mongoose.connect(setup.mongo_db, setup.mongo_options);<\/p>\n<p>UrlTable.findOne({ shortUrl:shortUrl }).then((result) =&gt; {<\/p>\n<p>\/\/\u5f85\u6dfb\u52a0\u9519\u8bef\u5904\u7406<\/p>\n<p>res.redirect(result.longUrl);<\/p>\n<p>})<\/p>\n<p>\u540e\u671f\u5927\u5bb6\u53ef\u4ee5\u5bf9\u4e00\u4e9b\u9519\u8bef\u5f02\u5e38\u5904\u7406\uff0c\u6570\u636e\u7edf\u8ba1\u7b49\u505a\u4e00\u4e9b\u589e\u5f3a\uff0c\u8fd9\u91cc\u5c31\u4e0d\u505a\u8865\u5145\u4e86\u3002<\/p>\n<p>\u4e0b\u9762\u8ba9\u6211\u4eec\u542f\u7528\u5e94\u7528\u5f00\u59cb\u6d4b\u8bd5\u5427\u3002<\/p>\n<h2>\u542f\u52a8\u5e94\u7528\u5e76\u6d4b\u8bd5<\/h2>\n<p>npm start<\/p>\n<p>\u542f\u52a8\u540e\uff0c\u9ed8\u8ba4\u7684\u8bbf\u95ee\u7aef\u53e3\u4e3a 3000\uff0c\u6211\u4eec\u9996\u5148\u6d4b\u8bd5\u4e0b\u77ed\u94fe\u63a5\u751f\u6210\u9875\uff0c\u8fd9\u91cc\u6211\u4eec post \u4e00\u4e2a\u540d\u4e3a longUrl \u7684\u957f\u94fe\u63a5\u53c2\u6570\uff0c\u6570\u636e\u5bf9\u8c61\u4e3a\uff1a<\/p>\n<p>{&#8220;longUrl&#8221; : &#8220;https:\/\/demo.grapecity.com.cn\/spreadjs\/SpreadJSTutorial\/features\/tables\/basic-table\/purejs&#8221;}<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/09\/20200930_5f74aa19c2ec4.gif\" alt=\"\u4e09\u6b65\u5e26\u4f60\u5f00\u53d1\u4e00\u4e2a\u77ed\u94fe\u63a5\u751f\u6210\u5e73\u53f0\" \/><\/p>\n<p>\u6210\u529f\u5347\u6210\u4e86\u5982\u4e0b\u77ed\u94fe\u63a5\uff1a<\/p>\n<p>http:\/\/localhost:3000\/iGE6ZlDmh<\/p>\n<p>\u6211\u4eec\u53ea\u8981\u901a\u8fc7\u8bbf\u95ee\u77ed\u94fe\u63a5\u80fd\u6b63\u5e38\u8df3\u8f6c\u81f3\u4fdd\u5b58\u7684\u957f\u8fde\u63a5\u5373\u53ef\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/09\/20200930_5f74aa1d9eb60.gif\" alt=\"\u4e09\u6b65\u5e26\u4f60\u5f00\u53d1\u4e00\u4e2a\u77ed\u94fe\u63a5\u751f\u6210\u5e73\u53f0\" \/><\/p>\n<p>\u8fd9\u6837\u5c31\u6d4b\u8bd5\u901a\u8fc7\u4e86\uff0c\u5176\u5b9e\u4ee3\u7801\u91cf\u4e0d\u5927\uff0c\u539f\u7406\u4e5f\u5f88\u7b80\u5355\u3002\u5927\u5bb6\u5982\u679c\u81ea\u5df1\u6709\u8f83\u77ed\u7684\u57df\u540d\u7684\u8bdd\uff0c\u4e0a\u7ebf\u540e\u4f1a\u8ba9\u94fe\u63a5\u53d8\u5f97\u66f4\u77ed\u3001\u66f4\u7f8e\u89c2\uff0c\u8fd9\u6837\u4e00\u4e2a\u5c5e\u4e8e\u6211\u4eec\u81ea\u5df1\u77ed\u94fe\u63a5\u751f\u6210\u5e73\u53f0\u5c31\u5f00\u53d1\u5b8c\u6210\u4e86\u3002\u4e0b\u9762\u9644\u4e0a\u6e90\u7801\uff0c\u6267\u884c npm install \u5373\u53ef\u81ea\u52a8\u5b89\u88c5\u6240\u6709\u4f9d\u8d56\uff0c\u5982\u679c\u5927\u5bb6\u6709\u95ee\u9898\uff0c\u53ef\u901a\u8fc7\u8bc4\u8bba\u533a\u544a\u8bc9\u6211\u3002<\/p>\n<p>\u6e90\u7801\u4e0b\u8f7d&gt;&gt;<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>16<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3483172\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : opengps <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u9996\u5148\u5f97\u6709\u4e00\u4e2a\u77ed\u57df\u540d\uff0c\u6211\u627e\u4e86\u597d\u51e0\u5e74\u53ea\u770b\u597d\u4e00\u4e2a\u4e2d\u610f\u7684(4 \u4f4d cn)\uff0c\u5df2\u5728\u4e2a\u4eba\u7f51\u7ad9\u4e0b\u7528\u4e86 3 \u5e74                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3483173\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : memedahui <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Livid                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3483174\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : easonHHH <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u76f4\u63a5\u62f7\u8d1d\u4ee3\u7801\u662f\u771f\u7684\u6ca1\u6709\u770b\u4e0b\u6765\u7684\u6b32\u671b\uff0c\u5efa\u8bae\u4ee3\u7801\u5757\u683c\u5f0f\u4e00\u4e0b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3483175\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xuxuxu123 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709\u4e2a\uff0c\u56db\u4f4d .com \u57df\u540d\uff1b<br \/>65we.com<br \/>\u6709\u9700\u8981\u7684\u561b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3483176\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yamedie <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8c8c\u4f3c\u662f KPI \u5e16<\/p>\n<p>\u6709\u4e2a\u7591\u95ee:<br \/>router.get(&#8216;\/:shortUrl&#8217;, function (req, res, next) { var shortUrl = req.params.shortUrl; mongoose.connect(setup.mongo_db, setup.mongo_options); UrlTable.findOne({ shortUrl:shortUrl }).then((result) =&gt; { \/\/\u5f85\u6dfb\u52a0\u9519\u8bef\u5904\u7406 res.redirect(result.longUrl); }) });<\/p>\n<p>\u4e3b\u8fd9\u6837\u5199, \u6bcf\u4e2a\u77ed\u94fe\u63a5\u7684 get \u8bf7\u6c42\u53d1\u6765, \u90fd\u73b0\u8fde\u63a5\u6570\u636e\u5e93, \u6548\u7387\u4e5f\u592a\u4f4e\u4e86\u5427? \u800c\u4e14\u8fde\u63a5\u6570\u636e\u5e93\u662f\u5f02\u6b65\u7684, \u9700\u8981\u56de\u8c03\u51fd\u6570\u6216\u8005 async\/await \u6267\u884c\u540e\u9762\u7684\u8bed\u53e5, \u8fd9\u91cc\u76f4\u63a5\u5199\u6210\u540c\u6b65\u5199\u6cd5\u4e86, \u8ba9\u6211\u6709\u70b9\u6478\u4e0d\u7740\u5934\u8111                                                             <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3483177\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zpfhbyx <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             yourls \u4e0d\u9999\u4e48\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3483178\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : shc <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u611f\u8c22\u4e3b\u7684\u6559\u7a0b\uff0c\u90a3\u5c31\u642d\u8f66\u51fa\u51e0\u4e2a\u77ed\u57df\u540d\u5427\uff0cpp.tc, mv.mk, 58.si, us.rs, vps.vc, git.tg, sir.sr, ts.st \uff0c\u611f\u5174\u8da3\u7684\u79c1\u804a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3483179\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : GrapeCityChina <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @yamedie \u4f60\u7684\u5efa\u8bae\u5f88\u597d\uff0c\u4f60\u8fd9\u6837\u4f1a\u4f7f\u6548\u7387\u66f4\u9ad8\uff0c\u8fd9\u4e5f\u662f\u4e00\u4e2a\u53ef\u4f18\u5316\u7684\u70b9                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3483180\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ylsc633 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u90a3\u6211\u4e5f\u642d\u8f66\u51fa\u4e2a\u57df\u540d?<\/p>\n<p>guof.com <\/p>\n<p>tsvv.com<br \/>qq-v.com                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3483181\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : linstrong <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e4b\u524d\u5728\u7f51\u4e0a\u627e\u4e86\u4e00\u4e2a MyURL \u7684\u77ed\u7f51\u5740\u7a0b\u5e8f\uff0c\u50bb\u74dc\u5f0f\u5b89\u88c5\uff0c\u552f\u4e00\u7684\u7f3a\u70b9\u5c31\u662f\u6ca1\u6709\u540e\u53f0\uff0c\u7528\u4e86\u4e00\u4e2a\u4e24\u4f4d\u7684.cm \u57df\u540d\u642d\u5efa\u4e86\u4e00\u4e2a\uff0c\u611f\u89c9\u8fd8\u884c                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3483182\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : heheda0 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e4b\u524d\u7528 go \u505a\u4e86\u4e00\u4e2a http:\/\/url.2048ai.cn\/short_url                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3483183\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zsdroid <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5148\u628a t.tt \u4e70\u4e86\uff0c\u518d\u6765\u8c08\u77ed\u94fe\u63a5\u751f\u6210\u5e73\u53f0                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3483184\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zhuweiyou <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7f3a\u7684\u662f\u7a0b\u5e8f\u5417?<br \/>\u6211\u7f3a\u7684\u662f\u77ed\u57df\u540d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3483185\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : JavaIO <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709\u4e2a\u77ed\u57df\u540d\u4e0d\u5bb9\u6613                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3483186\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : coloz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u77ed\u94fe\u63a5\u5e73\u53f0\u6709\u5565\u5546\u4e1a\u6a21\u5f0f\u4e0d\u3002\u6709\u4e2a 3 \u4f4d\u77ed\u57df\u540d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3483187\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Livid <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @memedahui \u8c22\u8c22\u4e3e\u62a5\u3002\u8fd9\u4e2a\u4e3b\u9898\u5df2\u7ecf\u88ab\u79fb\u52a8\u5230 \/go\/promotions \u5e76\u88ab\u4e0b\u6c89\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u4e09\u6b65\u5e26\u4f60\u5f00\u53d1\u4e00\u4e2a\u77ed\u94fe\u63a5\u751f\u6210\u5e73\u53f0 \u8cc7&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/161318"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=161318"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/161318\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=161318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=161318"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=161318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}