{"id":342,"date":"2016-06-30T16:28:25","date_gmt":"2016-06-30T08:28:25","guid":{"rendered":"http:\/\/sora.sound.moe\/?p=342"},"modified":"2016-06-30T16:28:25","modified_gmt":"2016-06-30T08:28:25","slug":"%e6%9e%84%e5%bb%banode-js%e5%b7%a5%e4%bd%9c%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/sora.sound.moe\/?p=342","title":{"rendered":"\u6784\u5efaNode.Js\u5de5\u4f5c\u73af\u5883"},"content":{"rendered":"<p>\u6700\u8fd1\u867d\u7136\u7ecf\u5e38\u5954\u6ce2\u4e8e\u5bb6\u548c\u533b\u9662\u4e4b\u95f4\uff0c\u4f46\u662f\u8fd8\u662f\u9f13\u6363\u4e86\u4e00\u4e0bNode\u3002\u5177\u4f53\u6bd4\u8f83\u590d\u6742\uff0c\u6211\u6162\u6162\u5199\u3002\u4e3b\u8981\u662f\u7ed9\u81ea\u5df1\u770b\u7684\uff01\u914d\u7f6e\u8fd9\u4e2a\u597d\u9ebb\u70e6OAQ\uff0c\u4e0b\u56de\u4e0d\u8981\u641e\u9519\u4e86\u3002<\/p>\n<p>\u672c\u6587\u4ecb\u7ecd\u642d\u5efa\u9488\u5bf9Sails+Vue\u7684\u65b9\u4fbf\u7684\u5f00\u53d1\u73af\u5883\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u6d89\u53ca\u5230\u7684\u8f6f\u4ef6<\/p>\n<p>Sails<\/p>\n<p>Webstorm<\/p>\n<p>Vue<\/p>\n<p>Vue-cli<\/p>\n<p>Vmware Station + Ubuntu<\/p>\n<p>\u5176\u4ed6\u5e38\u7528\u8f6f\u4ef6<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u4e00\u3001\u865a\u62df\u673a\u73af\u5883\u7b80\u4ecb<\/strong><\/p>\n<p>\u7531\u4e8e\u5728Win\u4e0b\u8fd0\u884cNode.Js\u4f1a\u6709\u4e00\u4e9b\u517c\u5bb9\u6027\u4e0a\u7684\u95ee\u9898\uff0c\u6bd4\u5982\u67d0\u4e9b\u5305\u6ca1\u6cd5\u5b89\u88c5\u4e0a\uff08\u6216\u8005\u5f97\u88c5\u4e2aVS\u624d\u80fd\u7f16\u8bd1\uff09\u7b49\uff0c\u4e8e\u662f\u5e72\u8106\u5f00\u4e2a\u865a\u62df\u673a\u5427\u3002<\/p>\n<p>\u672c\u6765\u8fd9\u91cc\u6253\u7b97\u91c7\u7528Hyper-V\u7684\uff0c\u4f46\u662f\u6211\u7684\u7535\u8111\u548cHyper-V\u54c1\u6027\u4e0d\u5408\uff0c\u6ca1\u6cd5\u5b89\u88c5\u4e0aUbuntu\u3002\u4e8e\u662f\u5c31\u7528\u4e86Vmware\u3002<\/p>\n<p>\u6309\u6b63\u5e38\u6d41\u7a0b\u5f00\u4e2a\u865a\u62df\u673a\uff0c\u88c5\u4e2aUbuntu\u3002\u7136\u540e\u5728Ubuntu\u91cc\u5b89\u88c5\u4e00\u4e0bssh\uff0c\u968f\u540e\u5c31\u4ece\u5916\u90e8\u8fde\u63a5\uff0c\u4e0d\u7528\u770b\u56fe\u5f62\u754c\u9762\u4e86\u6ca1\u4ec0\u4e48\u9e1f\u7528\u3002<\/p>\n<p>\u7136\u540e\u5b89\u88c5node\uff0c\u9ed8\u8ba4\u7684\u8f6f\u4ef6\u6e90\u7684node\u7248\u672c\u592a\u4e45\u4e86\uff0c\u6240\u4ee5\u6211\u91c7\u7528\u4e86<a href=\"https:\/\/github.com\/creationix\/nvm\">nvm<\/a>\u6765\u5b89\u88c5\uff0c\u8fd9\u4e2a\u4e5f\u5f88\u65b9\u4fbf\u554a\u3002\u7136\u540e<strong>\u5728\u5168\u5c40\u5b89\u88c5<\/strong>Sails\uff0c\u6069\uff0c\u5bf9\uff0c\u5c31\u662fnpm install -g sails\u3002<\/p>\n<p>\u4e2a\u4eba\u53ea\u662f\u628a\u8fd0\u884c\u73af\u5883\u653e\u5728Linux\uff0c\u5f00\u53d1\u8fd8\u662f\u5728Win\u7684\uff0c\u4e0b\u9762\u642d\u5efa\u4e24\u8005\u4e4b\u95f4\u7684\u94fe\u63a5\u3002<\/p>\n<p><strong>\u4e8c\u3001\u914d\u7f6eWebStorm<\/strong><\/p>\n<p>\u4e2a\u4eba\u91c7\u7528\u4e86JetBrains\u7684Webstorm\u4f5c\u4e3aIDE\u2026\u2026<\/p>\n<p><strong>\u914d\u7f6e\u90e8\u7f72<\/strong><\/p>\n<p>Tools -&gt; Deployment -&gt; Configuration<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone\" src=\"http:\/\/ww2.sinaimg.cn\/large\/e985a6f7gw1f5dbeieb3zj20ru0nuq72.jpg\" width=\"1002\" height=\"858\" \/><\/p>\n<p>\u8fd9\u91cc\u76f4\u63a5\u91c7\u7528\u4e86SFTP\u767b\u5f55\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u7528FTP\u4ec0\u4e48\u7684\u3002\u5982\u679c\u4f60\u559c\u6b22\uff0c\u4e5f\u53ef\u4ee5\u4e0e\u865a\u62df\u673a\u5171\u4eab\u6587\u4ef6\u5939\u3002<img decoding=\"async\" loading=\"lazy\" class=\"alignnone\" src=\"http:\/\/ww4.sinaimg.cn\/large\/e985a6f7gw1f5dbfssajgj20ru0nun05.jpg\" width=\"1002\" height=\"858\" \/><\/p>\n<p>\u5728Excluded Paths\u91cc\u628a\u4f9d\u8d56\u5305\u9664\u5916\uff0c\u4e4b\u524d\u6211\u5c45\u7136\u8111\u62bd\u7406\u89e3\u6210\u4e86Include\u3002\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone\" src=\"http:\/\/ww4.sinaimg.cn\/large\/e985a6f7gw1f5dbgx3te9j20ny0jaaes.jpg\" width=\"862\" height=\"694\" \/><\/p>\n<p>Tools -&gt; Deployment -&gt; Options \u91cc\u914d\u7f6e\u4e00\u4e0b\u81ea\u52a8\u68c0\u6d4b\u66f4\u6539\u81ea\u52a8\u4e0a\u4f20\u3002\u8fd9\u6837\u5c31\u5f88\u8212\u670d\u3002<\/p>\n<p>\u672c\u5730\u5f00\u53d1\u73af\u5883\u5c31\u662f\u8fd9\u6837\uff0c\u7136\u540eWebStorm\u53ef\u4ee5\u88c5\u4e00\u4e0bVue\u7684\u63d2\u4ef6\u2026\u2026\u6069\uff0c\u63a5\u4e0b\u6765\u662f\u8fd0\u884c\u73af\u5883\u7684\u642d\u5efa\u3002<\/p>\n<p><strong>\u4e09\u3001\u865a\u62df\u673a\u642d\u5efa\u8fd0\u884c\u73af\u5883<\/strong><\/p>\n<p><strong>\u5b89\u88c5Node.Js<\/strong><\/p>\n<p>\u8981\u5b89\u88c5\u6307\u5b9a\u7248\u672c\u7684Node\uff0c\u53ef\u4ee5\u4ece\u5b98\u7f51\u4e0b\u8f7d\u4e8c\u8fdb\u5236\u5305\uff0c\u4e5f\u53ef\u4ee5\u7528nvm\u3002\u8fd9\u91cc\u7528\u4e86nvm\u3002<\/p>\n<p>\u6309\u6307\u793a\u5b89\u88c5nvm\u540e\uff0c\u6267\u884c<\/p>\n<pre class=\"lang:default decode:true\">nvm install 6.2.2 \/\/ \u8fd9\u662f\u6307\u5b9a\u7684\u7248\u672c\u53f7\nnpm install -g sails \/\/ \u5168\u5c40\u5b89\u88c5sails\n<\/pre>\n<p>\u4f7f\u7528WebStorm\u4e0a\u4f20\u4ee3\u7801\u540e\uff0c\u8fdb\u5165\u6587\u4ef6\u5939\u6267\u884cnpm install\u5b89\u88c5\u4f9d\u8d56\u3002<\/p>\n<p>\u8fd9\u91cc\u63d0\u5230\u4e00\u4e0b\uff0cSails\u591a\u88c5\u4e86\u4e00\u4e2ahot reload\u7684\u63d2\u4ef6\uff0c\u53ef\u4ee5\u4fee\u6539\u4ee3\u7801\u540e\u4e0d\u7528\u91cd\u542f\u5c31\u751f\u6548\u2026\u2026\u8ddf\u8fd9\u4e2a\u81ea\u52a8\u4e0a\u4f20\u914d\u5408\u2026\u2026\u8d85\u597d\u7528\uff01<\/p>\n<p><strong>\u5b89\u88c5\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u867d\u7136sails\u53ef\u4ee5\u4f7f\u7528\u6587\u4ef6\u4f5c\u4e3a\u6570\u636e\u5e93\uff0c\u4f46\u662f\u8fd9\u6837\u4e0d\u597d\u8c03\u8bd5\u3002\u4e8e\u662f\u6211\u5b89\u88c5\u4e86mariadb+phpmyadmin\u3002<\/p>\n<p>MariaDB\u7684\u8bdd\u53ea\u9700\u8981\u6309\u7167<a href=\"https:\/\/downloads.mariadb.org\/mariadb\/repositories\/#mirror=marty-anstey&amp;distro=Ubuntu&amp;distro_release=xenial--ubuntu_xenial\">\u8fd9\u91cc<\/a>\u7684\u8bf4\u660e\u9009\u62e9\u955c\u50cf\u3001\u5b89\u88c5\u5373\u53ef\u3002<\/p>\n<p>\u4fee\u6539Sails\u7684\u914d\u7f6e\u6587\u4ef6\u8ba9\u5b83\u4f7f\u7528MariaDB\uff1a<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone\" src=\"http:\/\/ww3.sinaimg.cn\/large\/e985a6f7gw1f5dbxn88nnj20ss0cwwiu.jpg\" width=\"1036\" height=\"464\" \/><\/p>\n<p>\u6ce8\u610f\u8fd9\u91cc\u662f\u4fee\u6539\u5168\u5c40\u4e86\u3002\u4e5f\u53ef\u4ee5\u5728env\u90a3\u91cc\u5206\u5f00\u914d\u7f6e\u5f00\u53d1\u73af\u5883\u548c\u751f\u4ea7\u73af\u5883\u2190\u5176\u5b9e\u8fd9\u6837\u6bd4\u8f83\u79d1\u5b66\u3002<\/p>\n<p>\u4e0a\u8ff0\u5b8c\u6210\u540e\u5c31\u5f62\u6210\u4e86\u8fd9\u6837\u4e00\u4e2a\u5de5\u4f5c\u6d41\uff1a<\/p>\n<p>\u672c\u5730\u4fee\u6539\u4ee3\u7801 -&gt; \u81ea\u52a8\u4e0a\u4f20\u5230\u865a\u62df\u7684\u7684Ubuntu -&gt; hot reload -&gt; changes applied!<\/p>\n<p><strong>\u5b89\u88c5PhpMyAdmin<\/strong><\/p>\n<p>\u5b89\u88c5\u8fd9\u4e2a\u5c31\u9700\u8981\u4e2aphp\u8fd0\u884c\u73af\u5883\uff0c\u4e8e\u662f\u6211\u53c8\u5b89\u88c5Apache\u548cphp<\/p>\n<pre class=\"lang:default decode:true\">sudo apt-get install apache2\nsudo apt-get install php\nsudo apt-get install libapache2-mod-php php-mysql php-mbstring \/\/ \u94fe\u63a5\u4e0a\u9762\u4e24\u4e2a\u3001\u5b89\u88c5php\u8fd0\u884c\u4f9d\u8d56\nsudo \/usr\/sbin\/apache2ctl restart \/\/ \u91cd\u542fapache\n\n<\/pre>\n<p>\u7136\u540ePMA\u9ed8\u8ba4\u4e0d\u5141\u8bb8\u5bc6\u7801\u767b\u5f55\uff0c\u8fdb\u5165\u76ee\u5f55\u4fee\u6539config.sample.inc.config\u628a\u76f8\u5173\u914d\u7f6e\u9879\u6539\u6389\uff0c\u91cd\u547d\u540d\u4e3aconfig.inc.php\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p><strong>\u56db\u3001\u524d\u7aef\u5f00\u53d1\u73af\u5883\u642d\u5efa<\/strong><\/p>\n<p>Moesound\u7684\u524d\u7aef\u4e0e\u540e\u7aef\u5b8c\u5168\u5206\u79bb\uff0c\u6240\u4ee5\u524d\u7aef\u5c31\u662f\u91cd\u65b0\u5f00\u4e86\u4e2a\u7248\u672c\u5e93\u3002<\/p>\n<p>\u8fd9\u4e2a\u4f9d\u8d56\u5c31\u66f4\u591a\u4e86\uff0c\u4e0d\u8fc7\u4e5f\u662fnpm install\u5c31\u5b8c\u4e8b\u7684\u3002<\/p>\n<p>\u8ba9\u6211\u518d\u770b\u770b\u2026\u2026\u8fd9\u4e2a\u4e0d\u662f\u6211\u5199\u7684\u2026\u2026<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u867d\u7136\u7ecf\u5e38\u5954\u6ce2\u4e8e\u5bb6\u548c\u533b\u9662\u4e4b\u95f4\uff0c\u4f46\u662f\u8fd8\u662f\u9f13\u6363\u4e86\u4e00\u4e0bNode\u3002\u5177\u4f53\u6bd4\u8f83\u590d\u6742\uff0c\u6211\u6162\u6162\u5199\u3002\u4e3b\u8981\u662f\u7ed9\u81ea\u5df1\u770b\u7684\uff01\u914d\u7f6e\u8fd9\u4e2a &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/sora.sound.moe\/?p=342\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u6784\u5efaNode.Js\u5de5\u4f5c\u73af\u5883\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"twentyseventeen-featured-image":false,"twentyseventeen-thumbnail-avatar":false},"uagb_author_info":{"display_name":"Sora","author_link":"https:\/\/sora.sound.moe\/?author=1"},"uagb_comment_info":0,"uagb_excerpt":"\u6700\u8fd1\u867d\u7136\u7ecf\u5e38\u5954\u6ce2\u4e8e\u5bb6\u548c\u533b\u9662\u4e4b\u95f4\uff0c\u4f46\u662f\u8fd8\u662f\u9f13\u6363\u4e86\u4e00\u4e0bNode\u3002\u5177\u4f53\u6bd4\u8f83\u590d\u6742\uff0c\u6211\u6162\u6162\u5199\u3002\u4e3b\u8981\u662f\u7ed9\u81ea\u5df1\u770b\u7684\uff01\u914d\u7f6e\u8fd9\u4e2a&hellip;","_links":{"self":[{"href":"https:\/\/sora.sound.moe\/index.php?rest_route=\/wp\/v2\/posts\/342"}],"collection":[{"href":"https:\/\/sora.sound.moe\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sora.sound.moe\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sora.sound.moe\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sora.sound.moe\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=342"}],"version-history":[{"count":0,"href":"https:\/\/sora.sound.moe\/index.php?rest_route=\/wp\/v2\/posts\/342\/revisions"}],"wp:attachment":[{"href":"https:\/\/sora.sound.moe\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sora.sound.moe\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sora.sound.moe\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}