{"id":10008080,"date":"2023-07-12T11:00:27","date_gmt":"2023-07-12T03:00:27","guid":{"rendered":"https:\/\/ityet.com\/?p=10008080"},"modified":"2023-07-12T11:00:27","modified_gmt":"2023-07-12T03:00:27","slug":"%e3%80%90nestjs%e7%b3%bb%e5%88%97%e3%80%91%e4%bb%8enest-cli%e5%bc%80%e5%a7%8b%e5%85%a5%e9%97%a8","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10008080","title":{"rendered":"\u3010NestJS\u7cfb\u5217\u3011\u4eceNest CLI\u5f00\u59cb\u5165\u95e8"},"content":{"rendered":"<h2>\u521d\u8bc6Nest JS<\/h2>\n<p>Nest \u662f\u4e00\u4e2a\u6e10\u8fdb\u7684 Node.js \u6846\u67b6\uff0c\u5b83\u53ef\u4ee5\u5728 TypeScript \u548c JavaScript (ES6\u3001ES7\u3001ES8)\u4e4b\u4e0a\u6784\u5efa\u9ad8\u6548\u3001\u53ef\u4f38\u7f29\u7684\u4f01\u4e1a\u7ea7\u670d\u52a1\u5668\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>Nest \u57fa\u4e8e TypeScript \u7f16\u5199\u5e76\u4e14\u7ed3\u5408\u4e86 OOP\uff08\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b\uff09\uff0cFP\uff08\u51fd\u6570\u5f0f\u7f16\u7a0b\uff09\u548c FRP \uff08\u51fd\u6570\u5f0f\u54cd\u5e94\u7f16\u7a0b\uff09\u7684\u76f8\u5173\u7406\u5ff5\u3002\u5728\u8bbe\u8ba1\u4e0a\u7684\u5f88\u591a\u7075\u611f\u6765\u81ea\u4e8e Angular\uff0cAngular \u7684\u5f88\u591a\u6a21\u5f0f\u53c8\u6765\u81ea\u4e8e Java \u4e2d\u7684 Spring \u6846\u67b6\uff0c\u4f9d\u8d56\u6ce8\u5165\u3001\u9762\u5411\u5207\u9762\u7f16\u7a0b\u7b49\uff0c\u6240\u4ee5\u6211\u4eec\u4e5f\u53ef\u4ee5\u8ba4\u4e3a\uff1a<strong>Nest \u662f Node.js \u7248\u7684 Spring \u6846\u67b6<\/strong><\/p>\n<p>Nest \u6846\u67b6\u5e95\u5c42 HTTP \u5e73\u53f0\u9ed8\u8ba4\u662f\u57fa\u4e8e Express \u5b9e\u73b0\u7684\uff0c\u6240\u4ee5\u65e0\u9700\u62c5\u5fc3\u7b2c\u4e09\u65b9\u5e93\u7684\u7f3a\u5931\u3002<\/p>\n<p>NestJs \u7684\u6838\u5fc3\u601d\u60f3\uff1a\u5c31\u662f\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5c42\u4e0e\u5c42\u76f4\u63a5\u7684\u8026\u5408\u5ea6\u6781\u5c0f,\u62bd\u8c61\u5316\u6781\u9ad8\u7684\u4e00\u4e2a\u67b6\u6784\u4f53\u7cfb\u3002<\/p>\n<h2>\u811a\u624b\u67b6 NestJS CLI<\/h2>\n<p>\u4e0e\u5176\u5b83\u6846\u67b6\u4e00\u6837\uff0cNestJS\u4e5f\u6709\u81ea\u5df1\u7684\u811a\u624b\u67b6\uff0c\u5b83\u53ef\u5e2e\u52a9\u6211\u4eec\u5feb\u901f\u521d\u59cb\u5316Nest\u9879\u76ee\u4ee5\u53ca\u5f00\u53d1\u548c\u7ef4\u62a4 Nest \u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<h3>\u5b89\u88c5<\/h3>\n<p>\u7edd\u5927\u591a\u6570\u4eba\u53ef\u80fd\u4f1a\u9009\u62e9\u5168\u5c40\u5b89\u88c5\uff0c\u56e0\u4e3a\u65b9\u4fbf\uff0c\u4f46\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5168\u5c40\u5b89\u88c5<strong>\u4efb\u4f55<\/strong><code>npm<\/code>\u8f6f\u4ef6\u5305\u90fd\u4f1a\u5c06\u786e\u4fdd\u5b83\u4eec\u8fd0\u884c\u6b63\u786e\u7248\u672c\u7684\u8d23\u4efb\u7559\u7ed9\u6211\u4eec\u5f00\u53d1\u8005\u81ea\u8eab\u3002\u8fd9\u8fd8\u610f\u5473\u7740\uff0c\u5982\u679c\u4f60\u6709\u4e0d\u540c\u7684\u9879\u76ee\uff0c\u6bcf\u4e2a\u9879\u76ee\u90fd\u5c06\u8fd0\u884c<strong>\u76f8\u540c<\/strong>\u7248\u672c\u7684 CLI\u3002<\/p>\n<pre><code class=\"shell\">npm install -g @nestjs\/cli<\/code><\/pre>\n<p>\u26a0\ufe0f\u8fd9\u91cc\u9700\u8981\u6ce8\u610fNode\u7248\u672c\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u811a\u624b\u67b6\u5b89\u88c5\u6210\u529f\u4e86\u4f46\u521d\u59cb\u5316\u9879\u76ee\u65f6\u62a5\u9519\uff0c\u8fd9\u91cc\u5efa\u8bae\u4f7f\u7528\u9ad8\u7248\u672cnode\uff0c\u6211\u8fd9\u91cc\u7528\u662fnode\u7248\u672c\u662f<code>16.19.0<\/code><\/p>\n<p>\u5f53\u7136\u4f60\u4e5f\u53ef\u4ee5\u4e0d\u9009\u62e9\u5168\u5c40\u5b89\u88c5\uff0c<code>Nest<\/code>\u63d0\u4f9b\u4e86<code>@nestjs\/cli<\/code>\u5305\u540c\u6837\u53ef\u4ee5\u4f7f\u7528<code>nest<\/code>\u547d\u4ee4<\/p>\n<pre><code class=\"shell\">npx @nestjs\/cli@latest<\/code><\/pre>\n<h3>nest\u547d\u4ee4<\/h3>\n<p>\u5b89\u88c5\u5b8c\u811a\u624b\u67b6\u4e4b\u540e\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7<code>nest --help<\/code>\u770b\u770b\u5b83\u90fd\u6709\u54ea\u4e9b\u547d\u4ee4\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043999608\" alt=\"nest-1.png\" title=\"nest-1.png\"><\/p>\n<h4>new|n<\/h4>\n<p>\u8be5\u547d\u4ee4\u662f\u7528\u6765\u521d\u59cb\u5316\u4e00\u4e2a<code>Nest<\/code>\u9879\u76ee\u7684<\/p>\n<pre><code class=\"shell\">nest new project-name<\/code><\/pre>\n<p>\u8be5\u547d\u4ee4\u8868\u793a\u521d\u59cb\u5316\u4e00\u4e2a\u540d\u4e3a<code>project-name<\/code>\u7684<code>Nest<\/code>\u9879\u76ee\uff0c\u5e76\u4e14\u4f1a\u5e2e\u4f60\u5b89\u88c5\u597d\u6240\u6709\u5fc5\u8981\u7684\u4f9d\u8d56\uff0c\u7b80\u76f4\u5c31\u662f\u4e00\u6b65\u5230\u4f4d\uff0c\u975e\u5e38\u68d2\/~<\/p>\n<p>\u4e0a\u56fe\u4e2d\u6211\u4eec\u53ef\u4ee5\u770b\u5230<code>nest|n<\/code>\uff0c<code>n<\/code>\u4ee3\u8868<code>nest<\/code>\u7684\u522b\u540d\uff0c\u6240\u4ee5\u4e3a\u4e86\u65b9\u4fbf\uff0c\u4f60\u4e5f\u53ef\u4ee5\u8fd9\u6837\u4f7f\u7528\uff1a<\/p>\n<pre><code class=\"shell\">nest n project-name<\/code><\/pre>\n<h4>generate|g<\/h4>\n<p>\u8be5\u547d\u4ee4\u53ef\u4ee5\u4e3a\u6211\u4eec\u751f\u6210\u5404\u79cd\u4ee3\u7801\uff0c\u5176\u4e2d\u5305\u62ec\uff1a\u63a7\u5236\u5668Controller\u3001\u670d\u52a1service\u3001\u6a21\u5757module\u7b49\u3002<\/p>\n<pre><code class=\"shell\"># \u751f\u6210\u63a7\u5236\u5668\nnest generate controller controller-name\n\n# \u751f\u6210\u670d\u52a1\nnest generate service service-name\n\n# \u751f\u6210\u6a21\u5757\nnest generate module module-name<\/code><\/pre>\n<p>\u5f53\u4f60\u89c9\u5f97\u4e00\u4e2a\u4e00\u4e2a\u751f\u6210\u5f88\u9ebb\u70e6\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u8fd9\u4e2a\u547d\u4ee4<\/p>\n<pre><code class=\"shell\">nest g resource filename<\/code><\/pre>\n<p>\u5f53\u4f60\u6267\u884c\u8fd9\u4e2a\u547d\u4ee4\u65f6\uff0c\u5b83\u4f1a\u8ba9\u4f60\u9009\u62e9\u751f\u6210\u90a3\u79cd\u7c7b\u578b\u7684\u4ee3\u7801\uff1a<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043999609\" alt=\"nest-2.png\" title=\"nest-2.png\" loading=\"lazy\"><\/p>\n<p>\u8fd9\u91cc\u6211\u4eec\u76f4\u63a5\u9009\u62e9<code>REST API<\/code>\uff0c\u5b83\u4f1a\u518d\u95ee\u4f60\u662f\u5426\u9700\u8981\u751f\u6210CURD\u4ee3\u7801<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043999610\" alt=\"nest-3.png\" title=\"nest-3.png\" loading=\"lazy\"><\/p>\n<p>\u6211\u4eec\u9009\u62e9\u662f\u5c31\u597d\u4e86\uff0c\u8fd9\u4e2a\u5b83\u5c31\u4e3a\u6211\u4eec\u751f\u6210\u4e86\u4e00\u4e2a\u5b8c\u6574\u7684CURD\u4ee3\u7801\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043999611\" alt=\"nest-4.png\" title=\"nest-4.png\" loading=\"lazy\"><\/p>\n<p>\u6211\u4eec\u4f1a\u53d1\u73b0\u751f\u6210\u7684\u6587\u4ef6\u4e2d\u53ef\u80fd\u4f1a\u6709\u4e00\u4e9b\u6d4b\u8bd5\u6587\u4ef6\uff0c\u5f53\u6211\u4eec\u4e0d\u9700\u8981\u8fd9\u4e9b\u6587\u4ef6\u65f6\uff0c\u53ef\u4ee5\u76f4\u63a5\u5220\u9664\u6389\uff0c\u6216\u8005\u5728\u751f\u6210\u65f6\u52a0\u4e0a<code>--no-spec<\/code>\u8868\u793a\u4e0d\u751f\u6210\u6d4b\u8bd5\u6587\u4ef6<\/p>\n<pre><code class=\"shell\">nest g resource filename --no-spec<\/code><\/pre>\n<p>\u5f53\u7136\u5b83\u8fd8\u53ef\u4ee5\u751f\u6210\u66f4\u591a\u7c7b\u578b\u7684\u4ee3\u7801\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\uff1a<\/p>\n<pre><code class=\"shell\">nest g --help<\/code><\/pre>\n<h4>start<\/h4>\n<p>\u8be5\u547d\u4ee4\u7528\u4e8e\u542f\u52a8\u5f00\u53d1\u670d\u52a1\uff0c\u652f\u6301 watch \u548c\u8c03\u8bd5<\/p>\n<pre><code class=\"shell\"># \u542f\u52a8\nnest start\n\n# \u542f\u52a8\u5e76\u76d1\u542c\u6587\u4ef6\u53d8\u52a8\nnest start --watch\n\n#\u542f\u52a8\u5e76\u8c03\u8bd5\nnest start --debug --watch<\/code><\/pre>\n<p>\u8fd9\u4e9b\u547d\u4ee4\u53ef\u4ee5\u5728<code>package.json<\/code>\u6587\u4ef6\u4e2d\u627e\u5230<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043999612\" alt=\"nest-5.png\" title=\"nest-5.png\" loading=\"lazy\"><\/p>\n<p>\u6240\u4ee5\u6211\u4eec\u672c\u5730\u5f00\u53d1\u4e00\u822c\u4f7f\u7528<code>npm run start:dev<\/code>\u542f\u52a8\u9879\u76ee<\/p>\n<h4>build<\/h4>\n<p>\u8be5\u547d\u4ee4\u7528\u4e8e\u9879\u76ee\u6253\u5305<\/p>\n<pre><code class=\"shell\">nest build<\/code><\/pre>\n<p>\u5b83\u6709\u4e24\u79cd\u7f16\u8bd1\u65b9\u5f0f\u53ef\u9009\uff1a<code>--wepback<\/code> \u548c <code>--tsc<\/code> \uff0c\u9ed8\u8ba4\u662f tsc \u7f16\u8bd1\uff0c\u4e5f\u53ef\u4ee5\u5207\u6362\u6210 webpack\u3002<\/p>\n<p>\u533a\u522b\u5728\u4e8e<code>tsc<\/code>\u6a21\u5f0f\u5e76\u4e0d\u4f1a\u5c06<code>node_modules<\/code>\u6a21\u5757\u6253\u5305\u8fdb\u53bb\uff0c\u800c<code>webpack<\/code>\u6a21\u5f0f\u5219\u4f1a\u5c06node\u6a21\u5757\u6253\u5305\u6210\u5355\u6587\u4ef6<\/p>\n<h2>\u811a\u624b\u67b6\u914d\u7f6e\u6587\u4ef6<\/h2>\n<p><code>Nest<\/code>\u811a\u624b\u67b6\u4e0e\u5176\u5b83\u811a\u624b\u67b6\u4e0d\u540c\u7684\u662f\uff0c\u5b83\u751f\u6210\u7684\u9879\u76ee\u4e0b\u4f1a\u6709\u4e00\u4e2a\u811a\u624b\u67b6\u914d\u7f6e\u6587\u4ef6<code>nest-cli.json<\/code>\uff0c\u4e0a\u9762\u6211\u4eec\u7528\u7684\u547d\u4ee4\u7684\u5f88\u591a\u9009\u9879\u90fd\u53ef\u4ee5\u5728\u8fd9\u4e2a\u6587\u4ef6\u4e2d\u76f4\u63a5\u914d\u7f6e\u3002<\/p>\n<p>\u8be5\u6587\u4ef6\u7684\u9876\u7ea7\u5c5e\u6027\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li><code>&quot;collection&quot;<\/code>\uff1a\u6307\u5411\u7528\u4e8e\u751f\u6210\u7ec4\u4ef6\u7684\u539f\u7406\u56fe\u96c6\u5408\uff1b\uff08\u6700\u597d\u4e0d\u8981\u6539\uff09<\/li>\n<li><code>&quot;sourceRoot&quot;<\/code>\uff1a\u6307\u5411\u6807\u51c6\u6a21\u5f0f\u7ed3\u6784\u4e2d\u5355\u4e2a\u9879\u76ee\u7684\u6e90\u4ee3\u7801\u6839\u76ee\u5f55\uff0c\u6216monorepo \u6a21\u5f0f\u7ed3\u6784\u4e2d\u7684<em>\u9ed8\u8ba4\u9879\u76ee<\/em><\/li>\n<li><code>&quot;compilerOptions&quot;<\/code>\uff1a\u7f16\u8bd1\u76f8\u5173\u7684\u914d\u7f6e\u9009\u9879<\/li>\n<li><code>&quot;generateOptions&quot;<\/code>\uff1a\u5168\u5c40\u751f\u6210\u76f8\u5173\u7684\u914d\u7f6e\u9009\u9879<\/li>\n<li><code>&quot;monorepo&quot;<\/code>\uff1a\uff08\u4ec5\u9650 monorepo\uff09\u5bf9\u4e8e monorepo \u6a21\u5f0f\u7ed3\u6784\uff0c\u8be5\u503c\u59cb\u7ec8\u4e3a<code>true<\/code><\/li>\n<li><code>&quot;root&quot;<\/code>\uff1a\uff08\u4ec5\u9650 monorepo\uff09\u6307\u5411<em>\u9ed8\u8ba4\u9879\u76ee\u7684\u9879\u76ee\u6839\u76ee\u5f55<\/em><\/li>\n<\/ul>\n<h3>\u5168\u5c40\u7f16\u8bd1\u9009\u9879<\/h3>\n<p>\u8fd9\u4e9b\u5c5e\u6027\u6307\u5b9a\u8981\u4f7f\u7528\u7684\u7f16\u8bd1\u5668\u4ee5\u53ca\u5f71\u54cd<strong>\u4efb\u4f55<\/strong>\u7f16\u8bd1\u6b65\u9aa4\u7684\u5404\u79cd\u9009\u9879\uff0c\u65e0\u8bba\u662f\u4f5c\u4e3a<code>nest build<\/code>\u6216\u7684\u4e00\u90e8\u5206<code>nest start<\/code>\uff0c\u4e5f\u4e0d\u8003\u8651\u7f16\u8bd1\u5668\uff0c\u65e0\u8bba<code>tsc<\/code>\u662f\u8fd8\u662f webpack\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u540d\u79f0<\/th>\n<th>\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>webpack<\/code><\/td>\n<td>\u5982\u679c\u662f<code>true<\/code>\uff0c\u4f7f\u7528webpack\u7f16\u8bd1\u3002\u5982\u679c<code>false<\/code>\u5b58\u5728\u6216\u4e0d\u5b58\u5728\uff0c\u8bf7\u4f7f\u7528<code>tsc<\/code>. \u5728 monorepo \u6a21\u5f0f\u4e0b\uff0c\u9ed8\u8ba4\u4e3a<code>true<\/code>(use webpack)\uff0c\u5728\u6807\u51c6\u6a21\u5f0f\u4e0b\uff0c\u9ed8\u8ba4\u4e3a<code>false<\/code>(use <code>tsc<\/code>)\u3002<\/td>\n<\/tr>\n<tr>\n<td><code>tsConfigPath<\/code><\/td>\n<td>(<strong>\u4ec5 monorepo<\/strong> ) \u6307\u5411\u5305\u542b\u5728\u4e0d\u5e26\u9009\u9879\u7684\u60c5\u51b5\u4e0b\u8c03\u7528\u6216\u8c03\u7528<code>tsconfig.json<\/code>\u65f6\u5c06\u4f7f\u7528\u7684\u8bbe\u7f6e\u7684\u6587\u4ef6\uff08\u4f8b\u5982\uff0c\u5f53\u6784\u5efa\u6216\u542f\u52a8\u9ed8\u8ba4\u9879\u76ee\u65f6\uff09\u3002<code>nest build<\/code>`nest start<code>`project<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>webpackConfigPath<\/code><\/td>\n<td>\u6307\u5411 webpack \u9009\u9879\u6587\u4ef6\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0cNest \u4f1a\u67e5\u627e\u6587\u4ef6<code>webpack.config.js<\/code>. \u8bf7\u53c2\u9605\u4e0b\u9762\u7684\u66f4\u591a\u7ec6\u8282\u3002<\/td>\n<\/tr>\n<tr>\n<td><code>deleteOutDir<\/code><\/td>\n<td>\u5982\u679c<code>true<\/code>\uff0c\u5219\u6bcf\u5f53\u8c03\u7528\u7f16\u8bd1\u5668\u65f6\uff0c\u5b83\u90fd\u4f1a\u9996\u5148\u5220\u9664\u7f16\u8bd1\u8f93\u51fa\u76ee\u5f55\uff08\u5982 \u4e2d\u914d\u7f6e<code>tsconfig.json<\/code>\uff0c\u9ed8\u8ba4\u4e3a<code>.\/dist<\/code>\uff09\u3002<\/td>\n<\/tr>\n<tr>\n<td><code>assets<\/code><\/td>\n<td>\u6bcf\u5f53\u7f16\u8bd1\u6b65\u9aa4\u5f00\u59cb\u65f6\uff0c\u542f\u7528\u81ea\u52a8\u5206\u53d1\u975e TypeScript \u8d44\u6e90\uff08\u5728\u589e\u91cf\u7f16\u8bd1\u6a21\u5f0f\u4e0b\u4e0d\u4f1a\u53d1\u751f<strong>\u8d44\u6e90<\/strong><code>--watch<\/code>\u5206\u53d1\uff09\u3002\u8be6\u60c5\u8bf7\u53c2\u9605\u4e0b\u6587\u3002<\/td>\n<\/tr>\n<tr>\n<td><code>watchAssets<\/code><\/td>\n<td>\u5982\u679c<code>true<\/code>\uff0c\u5219\u4ee5\u76d1\u89c6\u6a21\u5f0f\u8fd0\u884c\uff0c\u76d1\u89c6<strong>\u6240\u6709<\/strong>\u975e TypeScript \u8d44\u6e90\u3002<\/td>\n<\/tr>\n<tr>\n<td><code>manualRestart<\/code><\/td>\n<td>\u5982\u679c\uff0c\u5219\u542f\u7528\u624b\u52a8\u91cd\u65b0\u542f\u52a8\u670d\u52a1\u5668\u7684<code>true<\/code>\u5feb\u6377\u65b9\u5f0f\u3002<code>rs<\/code>\u9ed8\u8ba4\u503c\u4e3a<code>false<\/code>\u3002<\/td>\n<\/tr>\n<tr>\n<td><code>builder<\/code><\/td>\n<td>\u6307\u793a CLI \u4f7f\u7528\u4ec0\u4e48<code>builder<\/code>\u6765\u7f16\u8bd1\u9879\u76ee\uff08<code>tsc<\/code>\u3001<code>swc<\/code>\u6216<code>webpack<\/code>\uff09\u3002\u8981\u81ea\u5b9a\u4e49\u6784\u5efa\u5668\u7684\u884c\u4e3a\uff0c\u60a8\u53ef\u4ee5\u4f20\u9012\u5305\u542b\u4e24\u4e2a\u5c5e\u6027\u7684\u5bf9\u8c61\uff1a<code>type<\/code>( <code>tsc<\/code>\u3001<code>swc<\/code>\u6216<code>webpack<\/code>) \u548c<code>options<\/code>\u3002<\/td>\n<\/tr>\n<tr>\n<td><code>typeCheck<\/code><\/td>\n<td>\u5982\u679c<code>true<\/code>\uff0c\u5219\u542f\u7528 SWC \u9a71\u52a8\u9879\u76ee\u7684\u7c7b\u578b\u68c0\u67e5\uff08\u5f53<code>builder<\/code>\u4e3a\u65f6<code>swc<\/code>\uff09\u3002\u9ed8\u8ba4\u503c\u4e3a<code>false<\/code>\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u5168\u5c40\u751f\u6210\u9009\u9879<\/h3>\n<p>\u8fd9\u4e9b\u5c5e\u6027\u6307\u5b9a\u547d\u4ee4\u4f7f\u7528\u7684\u9ed8\u8ba4\u751f\u6210\u9009\u9879<code>nest generate<\/code>\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u540d\u79f0<\/th>\n<th>\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>spec<\/code><\/td>\n<td>\u5982\u679c\u503c\u4e3a\u5e03\u5c14\u503c\uff0c\u5219\u9ed8\u8ba4\u60c5\u51b5\u4e0b<code>true<\/code>\u542f\u7528<code>spec<\/code>\u751f\u6210\uff0c\u503c\u4e3a \u5219<code>false<\/code>\u7981\u7528\u751f\u6210\u3002CLI \u547d\u4ee4\u884c\u4e0a\u4f20\u9012\u7684\u6807\u5fd7\u4f1a\u8986\u76d6\u6b64\u8bbe\u7f6e\uff0c\u9879\u76ee\u7279\u5b9a\u7684<code>generateOptions<\/code>\u8bbe\u7f6e\u4e5f\u4f1a\u8986\u76d6\u6b64\u8bbe\u7f6e\uff08\u66f4\u591a\u5185\u5bb9\u89c1\u4e0b\u6587\uff09\u3002\u5982\u679c\u8be5\u503c\u662f\u4e00\u4e2a\u5bf9\u8c61\uff0c\u5219\u6bcf\u4e2a\u952e\u4ee3\u8868\u4e00\u4e2a\u539f\u7406\u56fe\u540d\u79f0\uff0c\u5e76\u4e14\u5e03\u5c14\u503c\u786e\u5b9a\u662f\u5426\u4e3a\u8be5\u7279\u5b9a\u539f\u7406\u56fe\u542f\u7528\/\u7981\u7528\u9ed8\u8ba4\u89c4\u8303\u751f\u6210\u3002<\/td>\n<\/tr>\n<tr>\n<td><code>flat<\/code><\/td>\n<td>\u5982\u679c\u4e3a true\uff0c\u5219\u6240\u6709\u751f\u6210\u547d\u4ee4\u90fd\u5c06\u751f\u6210\u5e73\u9762\u7ed3\u6784<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u672c\u7cfb\u5217\u6587\u7ae0\u4f1a\u6301\u7eed\u66f4\u65b0\u54e6\uff0c\u5173\u6ce8\u524d\u7aef\u5357\u7396\uff0c\u656c\u8bf7\u671f\u5f85\u5427~<\/strong><\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000043999606\">https:\/\/segmentfault.com\/a\/1190000043999606<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u521d\u8bc6Nest JS Nest \u662f\u4e00\u4e2a\u6e10\u8fdb\u7684 Node.js \u6846\u67b6\uff0c\u5b83\u53ef\u4ee5\u5728 TypeScript \u548c Java [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10008080","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008080","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10008080"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008080\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10008080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10008080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10008080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}