{"id":220478,"date":"2020-11-18T09:05:44","date_gmt":"2020-11-18T01:05:44","guid":{"rendered":"http:\/\/4563.org\/?p=220478"},"modified":"2020-11-18T09:05:44","modified_gmt":"2020-11-18T01:05:44","slug":"%e5%9f%ba%e4%ba%8e-node-js-%e7%9a%84%e7%bd%91%e5%85%b3%e8%ae%be%e8%ae%a1","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=220478","title":{"rendered":"\u57fa\u4e8e node.js \u7684\u7f51\u5173\u8bbe\u8ba1."},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u57fa\u4e8e node.js \u7684\u7f51\u5173\u8bbe\u8ba1.               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : qfdk <\/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>\u6700\u8fd1\u9700\u8981\u8bbe\u8ba1\u4e00\u4e2a node.js \u7684\u7f51\u5173.<\/p>\n<p>\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u4e00\u4e2a nodejs \u7684\u53cd\u5411\u4ee3\u7406.<\/p>\n<p>Spring \u5168\u5bb6\u6876 \u91cc\u9762\u6709 Zuul \u8fd9\u4e2a\u770b\u95e8\u53e3<\/p>\n<p>\u7f51\u4e0a\u90fd\u770b\u4e86\u4e00\u5708 \u6709\u8fd9\u4e48\u51e0\u4e2a\u9009\u62e9<\/p>\n<ul>\n<li>express-gateway<\/li>\n<li>http-proxy<\/li>\n<\/ul>\n<p>\u4e3a\u4e86\u907f\u514d\u9020\u8f6e\u5b50,\u60f3\u8ddf\u8bf8\u4f4d\u8001\u54e5\u8bf7\u6559\u4e00\u4e0b.<\/p>\n<p>\u8bf4\u4e00\u4e0b\u6211\u4eec\u57fa\u672c\u7684\u9700\u6c42:<\/p>\n<ul>\n<li>\u9ad8\u6027\u80fd<\/li>\n<li>\u53ef\u4ee5\u53d1\u9001\u9759\u6001\u9875\u9762<\/li>\n<li>\u53ef\u4ee5\u9274\u6743\u8ba4\u8bc1 \u521d\u6b65 \u51c6\u5907 JWT + oauth2 (\u6211\u4eec gateway \u662f\u6709\u72b6\u6001\u7684,\u6211\u4eec\u4f1a\u628a token \u7ed9\u5b58\u5728 Redis \u91cc\u9762 \u7136\u540e\u7ed9\u5ba2\u6237\u4e00\u4e2a session, \u907f\u514d\u7528\u6237\u4e4b\u95f4\u7528 token \u6765\u8c03\u7528\u6211\u4eec\u540e\u7aef)<\/li>\n<li>\u53ef\u4ee5\u52a0 CSRF<\/li>\n<li>\u6839\u636e\u6743\u9650\u6765\u8fc7\u6ee4\u8bf7\u6c42<\/li>\n<\/ul>\n<p>\u518d\u6b21 \u8c22\u8fc7<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4443750\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chogath <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u4ee5\u53c2\u8003\u4e0b `@acheetahk\/request` \u7684 fastProxy                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4443751\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chogath <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/github.com\/A-CheetahK\/acheetahk\/tree\/master\/packages\/request                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4443752\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chogath <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709\u95ee\u9898\u53ef\u4ee5\u7ed9\u6211\u63d0 issue                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4443753\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : kenshinhu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             kong gateway                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4443754\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : qfdk <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @kenshinhu \u8fd9\u4e2a\u770b\u5230\u4e86 \u4e0d\u8fc7\u4e0d\u662f nodejs \u7684\u6280\u672f\u6808 \u867d\u7136\u6027\u80fd\u5389\u5bb3                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4443755\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : qfdk <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @chogath humm \u56de\u5934\u6211\u597d\u597d\u770b\u4e00\u4e0b \u4e0d\u60f3\u9020\u8f6e\u5b50<br \/> \u751f\u4ea7\u73af\u5883\u7528\u4e00\u4e2a\u5f00\u6e90\u9879\u76ee\u8981\u770b\u4e0b\u540e\u9762\u7684\u751f\u6001\u7684 \u8fd8\u6709\u6587\u6863\u7b49\u7b49. \u611f\u8c22                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4443756\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chogath <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @qfdk node.js \u6ca1\u6709\u5355\u72ec\u505a\u7f51\u5173\u7684\u5f00\u6e90\u5305\uff0c\u6709\u7684\u53ea\u662f\u96f6\u6563\u7684\u65b9\u6cd5\uff0c\u76ee\u524d\u6765\u770b\u65b9\u6848\u6709\u4e09\u79cd\uff1a<\/p>\n<p>1. \u4f7f\u7528 http request pipe \u91cd\u5199\uff0c\u4ee3\u7406\u5230\u76ee\u6807\u670d\u52a1\u5668\u5b8c\u6210\u8bf7\u6c42\u8f6c\u53d1<br \/>2. \u4f7f\u7528 websocket \u7684\u65b9\u5f0f\u5b8c\u6210\u8bf7\u6c42\u8f6c\u53d1 # https:\/\/docs.nestjs.cn\/7\/websockets # \u53c2\u8003\u8d44\u6599\u6765\u81ea nest.js<br \/>3. \u4f7f\u7528 grpc \u81ea\u5df1\u5b9e\u73b0 interface + \u534f\u8bae + \u4f20\u8f93\u683c\u5f0f + \u5f02\u5e38\u4fe1\u606f\u5b9a\u4e49 # https:\/\/docs.nestjs.cn\/7\/microservices?id=grpc #\u53c2\u8003\u8d44\u6599\u6765\u81ea nest.js                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4443757\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chogath <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u662f\u7528\u7684 1 + 3\uff0c1 \u9002\u5408\u5e38\u89c4\u4e1a\u52a1\u76f4\u63a5\u8c03\u7528\uff0c3 \u9002\u5408\u670d\u52a1\u95f4\u8c03\u7528\uff08\u6307\u591a\u4e2a\u670d\u52a1\u8c03\u7528\uff0c\u6216\u8005\u5f62\u6210\u4e86\u8c03\u7528\u94fe\uff09                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4443758\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chogath <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @qfdk \u6211\u5efa\u8bae\u4f60\u5148\u5427\u76ee\u524d\u4f60\u89c9\u5f97\u5408\u9002\u7684\u65b9\u6848\u8dd1\u6210 demo\uff0c\u505a\u4e00\u4e0b\u6027\u80fd\u538b\u6d4b\u548c\u5404\u65b9\u9762\u7684\u8bc4\u4f30\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u57fa\u4e8e node.js \u7684\u7f51\u5173\u8bbe\u8ba1.&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\/220478"}],"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=220478"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/220478\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=220478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=220478"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=220478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}