[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"knowledge-\u002Fapi\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs":3,"knowledge-related-\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs":362,"knowledge-series-\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs":381},{"source":4,"connector":5,"page":6},"sqlite","better-sqlite3",{"path":7,"title":8,"description":9,"category":10,"tags":11,"date":13,"pinned":14,"draft":14,"body":15,"seo":358,"stem":359,"id":360,"extension":361},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs","NestJS 导读","NestJS 是基于 Node.js 的 TypeScript 服务端框架，采用模块化与依赖注入，默认 HTTP 平台为 Express，可切换 Fastify。见 后端入门。","技能小册",[12],"nestjs","2025-06-21",false,{"type":16,"value":17,"toc":349},"minimark",[18,22,47,57,248,252,262,270,277,294,297,300],[19,20,8],"h1",{"id":21},"nestjs-导读",[23,24,25,32,33,37,38,41,42,46],"p",{},[26,27,31],"a",{"href":28,"rel":29},"https:\u002F\u002Fdocs.nestjs.com\u002F",[30],"nofollow","NestJS"," 是基于 Node.js 的 TypeScript 服务端框架，采用",[34,35,36],"strong",{},"模块化","与",[34,39,40],{},"依赖注入","，默认 HTTP 平台为 Express，可切换 Fastify。见 ",[26,43,45],{"href":44},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fbasics","后端入门","。",[48,49,51,52,56],"h2",{"id":50},"学习路径主线-new","学习路径（主线 ",[53,54,55],"code",{},"new\u002F","）",[58,59,60,76],"table",{},[61,62,63],"thead",{},[64,65,66,70,73],"tr",{},[67,68,69],"th",{},"顺序",[67,71,72],{},"主题",[67,74,75],{},"文档",[77,78,79,94,113,127,153,172,190,204,234],"tbody",{},[64,80,81,85,88],{},[82,83,84],"td",{},"1",[82,86,87],{},"架构与 CLI",[82,89,90],{},[26,91,93],{"href":92},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fbase","基础概念",[64,95,96,99,102],{},[82,97,98],{},"2",[82,100,101],{},"模块与 DI",[82,103,104,108,109],{},[26,105,107],{"href":106},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fmodule","module"," → ",[26,110,112],{"href":111},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fservice","service",[64,114,115,118,121],{},[82,116,117],{},"3",[82,119,120],{},"HTTP 入口",[82,122,123],{},[26,124,126],{"href":125},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fcontroller","controller",[64,128,129,132,135],{},[82,130,131],{},"4",[82,133,134],{},"请求管道",[82,136,137,108,141,108,145,108,149],{},[26,138,140],{"href":139},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fmiddleware","middleware",[26,142,144],{"href":143},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fpipes","pipes",[26,146,148],{"href":147},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fguards","guards",[26,150,152],{"href":151},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fintercept","intercept",[64,154,155,158,161],{},[82,156,157],{},"5",[82,159,160],{},"横切能力",[82,162,163,167,168],{},[26,164,166],{"href":165},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Ferror","error","、",[26,169,171],{"href":170},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fcustom-decorators","custom-decorators",[64,173,174,177,180],{},[82,175,176],{},"6",[82,178,179],{},"配置与数据",[82,181,182,108,186],{},[26,183,185],{"href":184},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fconfig","config",[26,187,189],{"href":188},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fdatabase","database",[64,191,192,195,198],{},[82,193,194],{},"7",[82,196,197],{},"安全",[82,199,200],{},[26,201,203],{"href":202},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fauth","auth",[64,205,206,209,212],{},[82,207,208],{},"8",[82,210,211],{},"基础设施",[82,213,214,167,218,167,222,167,226,167,230],{},[26,215,217],{"href":216},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Flogger","logger",[26,219,221],{"href":220},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fcache","cache",[26,223,225],{"href":224},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fcron","cron",[26,227,229],{"href":228},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fqueue","queue",[26,231,233],{"href":232},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fwebsocket","webSocket",[64,235,236,239,242],{},[82,237,238],{},"9",[82,240,241],{},"上线",[82,243,244],{},[26,245,247],{"href":246},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fnew\u002Fdeploy","deploy",[48,249,251],{"id":250},"请求生命周期简图","请求生命周期（简图）",[253,254,259],"pre",{"className":255,"code":257,"language":258},[256],"language-text","Client\n  → Middleware\n  → Guards\n  → Interceptors (before)\n  → Pipes\n  → Controller handler\n  → Interceptors (after)\n  → Exception filters（若出错）\n  → Response\n","text",[53,260,257],{"__ignoreMap":261},"",[23,263,264,265,46],{},"详见官方 ",[26,266,269],{"href":267,"rel":268},"https:\u002F\u002Fdocs.nestjs.com\u002Ffaq\u002Frequest-lifecycle",[30],"Request lifecycle",[48,271,273,274],{"id":272},"旧版目录-before","旧版目录 ",[53,275,276],{},"before\u002F",[23,278,279,281,282,285,286,288,289,293],{},[53,280,276],{}," 为早期笔记，",[34,283,284],{},"仅供对照","；新项目请跟 ",[53,287,55],{}," 主线，并以 ",[26,290,292],{"href":28,"rel":291},[30],"官方文档"," 为准。",[48,295,296],{"id":296},"参考文献",[23,298,299],{},"以下链接在编写时均可正常访问：",[58,301,302,312],{},[61,303,304],{},[64,305,306,309],{},[67,307,308],{},"资料",[67,310,311],{},"说明",[77,313,314,325,337],{},[64,315,316,322],{},[82,317,318],{},[26,319,321],{"href":28,"rel":320},[30],"NestJS 文档",[82,323,324],{},"英文官方",[64,326,327,334],{},[82,328,329],{},[26,330,333],{"href":331,"rel":332},"https:\u002F\u002Fdocs.nestjs.com\u002Ffirst-steps",[30],"First steps",[82,335,336],{},"创建项目",[64,338,339,346],{},[82,340,341],{},[26,342,345],{"href":343,"rel":344},"https:\u002F\u002Fdocs.nestjs.com\u002Ffundamentals\u002Fcustom-providers",[30],"Fundamentals",[82,347,348],{},"核心概念",{"title":261,"searchDepth":350,"depth":350,"links":351},2,[352,354,355,357],{"id":50,"depth":350,"text":353},"学习路径（主线 new\u002F）",{"id":250,"depth":350,"text":251},{"id":272,"depth":350,"text":356},"旧版目录 before\u002F",{"id":296,"depth":350,"text":296},{"title":8,"description":9},"knowledge\u002Fbooklet\u002Fend\u002FNestJS\u002Findex","knowledge\u002Fknowledge\u002Fbooklet\u002Fend\u002FNestJS\u002Findex.md","md",{"items":363},[364,368,371,374,375,378],{"path":44,"title":365,"description":366,"category":10,"score":367},"后端入门概览","本目录覆盖 JavaScript\u002FTypeScript 服务端运行时与框架、数据存储，以及 Rust 系统编程入门，提供从零到部署的完整学习路径。前置建议：JavaScript 基础、工程化 · 环境变量。",6,{"path":202,"title":369,"description":370,"category":10,"score":367},"认证与授权","认证（Authentication）：确认「你是谁」（如 JWT、Session）。 - 授权（Authorization）：确认「你能做什么」（如 RBAC、策略检查）。",{"path":220,"title":372,"description":373,"category":10,"score":367},"缓存","@nestjs\u002Fcache-manager 统一缓存 API，存储实现可插拔。",{"path":7,"title":8,"description":9,"category":10,"score":367},{"path":111,"title":376,"description":377,"category":10,"score":367},"提供者与服务","Service 是最常见的 Provider，封装业务逻辑。见 module。",{"path":379,"title":380,"description":261,"category":10,"score":367},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fbefore\u002Fenv","环境加载",{"series":382,"title":383,"items":384,"index":627,"prev":628,"next":629},"booklet\u002Fend","end",[385,389,393,397,399,403,406,410,414,415,419,423,425,428,431,435,438,441,445,448,452,456,459,463,467,471,473,476,480,484,488,492,496,500,504,507,511,515,518,522,526,530,534,537,541,545,548,552,555,559,562,563,567,571,575,578,582,586,590,594,596,600,603,605,609,613,617,620,624],{"path":386,"title":387,"date":388,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Frust\u002Fasync","第九章：并发与异步","2020-05-22",{"path":390,"title":391,"date":392,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnodejs\u002Fasync","异步编程与模式","2025-08-20",{"path":394,"title":395,"date":396,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fdeno\u002Fauth","权限模型","2021-04-01",{"path":202,"title":369,"date":398,"pinned":14},"2025-12-23",{"path":400,"title":401,"date":402,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Frust\u002Fbase","Rust 基础","2020-07-21",{"path":92,"title":404,"date":405,"pinned":14},"NestJS 基础","2021-03-09",{"path":407,"title":408,"date":409,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fdeno\u002Fbase","Deno 基础","2026-06-01",{"path":411,"title":412,"date":413,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fbun\u002Fbase","Bun 基础与核心命令","2026-07-23",{"path":44,"title":365,"date":413,"pinned":14},{"path":416,"title":417,"date":418,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnodejs\u002Fcore\u002Fbuffer","缓冲区","2025-01-30",{"path":420,"title":421,"date":422,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fbun-deno-node","Bun \u002F Deno \u002F Node 对比","2024-04-23",{"path":220,"title":372,"date":424,"pinned":14},"2025-07-04",{"path":184,"title":426,"date":427,"pinned":14},"配置管理（Config 模块）","2023-08-26",{"path":125,"title":429,"date":430,"pinned":14},"控制器与路由","2020-07-18",{"path":432,"title":433,"date":434,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Frust\u002Fcore","第三章：所有权、借用与生命周期（核心）","2023-05-09",{"path":224,"title":436,"date":437,"pinned":14},"定时任务","2023-04-12",{"path":170,"title":439,"date":440,"pinned":14},"自定义装饰器","2021-09-19",{"path":442,"title":443,"date":444,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Frust\u002Fdata-type","第四章：复合数据类型","2021-02-24",{"path":188,"title":446,"date":447,"pinned":14},"数据库集成（以 TypeORM 为例）","2023-05-26",{"path":449,"title":450,"date":451,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fbefore\u002Fdatabase","数据库的配置","2024-06-22",{"path":453,"title":454,"date":455,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fbefore\u002Fdemo","入手Demo","2022-10-15",{"path":246,"title":457,"date":458,"pinned":14},"部署与运维","2023-01-24",{"path":460,"title":461,"date":462,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fbun\u002Fdeploy","生产环境与部署指南","2024-08-31",{"path":464,"title":465,"date":466,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Frust\u002Fdocs","第八章：测试、文档与质量","2026-01-11",{"path":468,"title":469,"date":470,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fejs","EJS","2019-11-03",{"path":379,"title":380,"date":472,"pinned":14},"2024-09-01",{"path":165,"title":474,"date":475,"pinned":14},"异常处理","2020-01-28",{"path":477,"title":478,"date":479,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnodejs\u002Ferror","错误处理与健壮性","2021-01-24",{"path":481,"title":482,"date":483,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Frust\u002Ferror","第五章：错误处理","2023-11-03",{"path":485,"title":486,"date":487,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnodejs\u002Fbase\u002Fevent","事件驱动与非阻塞 I\u002FO 模型","2020-06-20",{"path":489,"title":490,"date":491,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnodejs\u002Fbase\u002Fevent-loop","事件循环","2024-11-20",{"path":493,"title":494,"date":495,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fbefore\u002Fexce","异常处理器","2026-03-17",{"path":497,"title":498,"date":499,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fexpress","Express","2022-01-24",{"path":501,"title":502,"date":503,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnodejs\u002Fcore\u002Ffs","文件系统","2026-06-04",{"path":147,"title":505,"date":506,"pinned":14},"守卫 (Guards) 与授权","2023-09-09",{"path":508,"title":509,"date":510,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fdeno\u002Fhttp","HTTP 服务器","2020-12-11",{"path":512,"title":513,"date":514,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnodejs\u002Fcore\u002Fhttp","网络编程","2023-01-27",{"path":516,"title":509,"date":517,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fbun\u002Fhttp","2026-07-12",{"path":519,"title":520,"date":521,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fbefore\u002Finfo","归档说明（before\u002F）","2023-08-31",{"path":523,"title":524,"date":525,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fdeno\u002Finit","项目初始化与基础命令","2025-02-14",{"path":527,"title":528,"date":529,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fbefore\u002Finjectable","操作日志拦截器","2020-02-20",{"path":531,"title":532,"date":533,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fdeno\u002Finstall","安装与环境","2021-02-05",{"path":151,"title":535,"date":536,"pinned":14},"拦截器 (Interceptors)","2021-04-26",{"path":538,"title":539,"date":540,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fbefore\u002Fitc","统一响应格式拦截器","2023-08-17",{"path":542,"title":543,"date":544,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fbefore\u002Fjwt","JWT 与 Passport 授权","2021-08-10",{"path":216,"title":546,"date":547,"pinned":14},"日志记录","2022-10-10",{"path":549,"title":550,"date":551,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fbefore\u002Fmi","Nest 中间件","2022-06-21",{"path":139,"title":553,"date":554,"pinned":14},"中间件 (Middleware)","2021-11-26",{"path":556,"title":557,"date":558,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnodejs\u002Fbase\u002Fmodule","模块系统","2020-07-01",{"path":106,"title":560,"date":561,"pinned":14},"模块系统与依赖注入","2022-06-15",{"path":7,"title":8,"date":13,"pinned":14},{"path":564,"title":565,"date":566,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fbefore\u002Fnext","路由守卫","2022-12-01",{"path":568,"title":569,"date":570,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnodejs\u002Fcore\u002Fother","其他常用模块","2020-03-27",{"path":572,"title":573,"date":574,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fdeno\u002Fother","其他配置","2022-02-08",{"path":576,"title":573,"date":577,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnestjs\u002Fbefore\u002Fother","2022-05-23",{"path":579,"title":580,"date":581,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Frust\u002Fother","第十章：进阶特性与模式","2023-12-29",{"path":583,"title":584,"date":585,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Frust\u002Fpackage","第七章：模块系统与包管理","2024-05-26",{"path":587,"title":588,"date":589,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fdeno\u002Fpackage","包管理与依赖","2024-07-21",{"path":591,"title":592,"date":593,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnodejs\u002Fcore\u002Fpath","路径处理","2024-03-14",{"path":143,"title":595,"date":430,"pinned":14},"管道 (Pipes) 与数据验证",{"path":597,"title":598,"date":599,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnodejs\u002Fcore\u002Fprocess","进程与子进程","2023-11-10",{"path":228,"title":601,"date":602,"pinned":14},"队列（Bull）","2021-07-01",{"path":111,"title":376,"date":604,"pinned":14},"2024-12-02",{"path":606,"title":607,"date":608,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnodejs\u002Fcore\u002Fstream","流","2022-05-03",{"path":610,"title":611,"date":612,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Frust\u002Ft","泛型与 Trait","2024-10-31",{"path":614,"title":615,"date":616,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fdeno\u002Ftools","内置工具链","2026-01-24",{"path":618,"title":619,"date":462,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Frust\u002Ftype","第二章：基础语法与类型",{"path":621,"title":622,"date":623,"pinned":14},"\u002Fknowledge\u002Fbooklet\u002Fend\u002Fnodejs\u002Fbase\u002Fvar","全局对象与变量","2025-01-03",{"path":232,"title":625,"date":626,"pinned":14},"WebSocket（网关）","2022-12-14",50,{"path":106,"title":560,"date":561,"pinned":14},{"path":564,"title":565,"date":566,"pinned":14}]