你瞅啥呢

随笔分类 -  nestJS

摘要:2025-11-29 NestJS菜单模块CRUD接口开发指南(deepseek)在 NestJS 开发中,确实有一些可以遵循的"公式"或最佳实践模式。让我为你总结一套完整的 NestJS 接口开发公式: 🎯 NestJS 接口开发通用公式 1. 模块结构公式 src/modules/{模块名}/ ├── {模块名}.controller.ts # 控制器 ├── {模块名}. 阅读全文
posted @ 2025-11-29 17:12 叶乘风 阅读(13) 评论(0) 推荐(0)
摘要:2025-11-28 用后端java的架构来类比 NestJS 的各个部分(deepseek)Java和NestJS在设计理念和架构模式上有很深的渊源。NestJS 本身很大程度上受到了 Spring Boot 和 Angular 的启发。 核心概念类比 NestJS 部件 Java/Spring 类比 核心职责 Module (模块) @Configuration 配置类 / Java 包 阅读全文
posted @ 2025-11-28 20:53 叶乘风 阅读(17) 评论(0) 推荐(0)
摘要:2025-11-28 用前端react的架构来类比 NestJS 的各个部分(deepseek)核心概念类比 NestJS 部件 React 类比 核心职责 Module (模块) App.js 或功能模块文件夹 组织与封装。将相关的功能(控制器、服务等)打包在一起,形成高内聚、低耦合的功能单元。 Controller (控制器) 页面组件 / 路由组件 处理 HTTP 请求和响应。它定义了 阅读全文
posted @ 2025-11-28 20:49 叶乘风 阅读(13) 评论(0) 推荐(0)
摘要:2025-11-27 用前端vue的架构来类比 NestJS 的各个部分(deepseek)用 前端Vue的架构来类比 NestJS 的各个部分: 1. DTO (Data Transfer Object) - Vue 中的 Props/表单验证规则 Vue 中的 Props 定义: // Vue 组件 Props export interface UserFormProps { user 阅读全文
posted @ 2025-11-27 14:43 叶乘风 阅读(5) 评论(0) 推荐(0)
摘要:2025-11-21 nestJS报错:找不到名称“Get”==》没有引入Get装饰器代码: import { Controller } from '@nestjs/common'; @Controller('article') export class ArticleController { @Get() index() { return '我是一个文章列表'; } } 原因:没有 阅读全文
posted @ 2025-11-21 00:24 叶乘风 阅读(4) 评论(0) 推荐(0)
摘要:2024-03-06 Invalid schematic "entity". Please, ensure that "entity" exists in this collection.==》你应该使用了不正确的命令这个问题,其实就是文心一言误导了我,它告诉我创建实体类的命令为: nest g entity 你的实体类名称 但实际上,创建实体类应该用class,而不是entity。 所以,解决方案为更正命令,正确命令为: nest g class 你的实体类名称 但是,但是!上面这个命令不会生成entity,你 阅读全文
posted @ 2024-03-06 17:59 叶乘风 阅读(92) 评论(0) 推荐(0)
摘要:2024-03-06 Module '"@nestjs/platform-express"' has no exported member 'ExpressModule'.找不到ExpressModule这个模块问题描述:nestjs后端开发,遇到跨域问题,打算用express来配合处理,结果引入express的一个模块失败。 app.modules.ts import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; imp 阅读全文
posted @ 2024-03-06 11:33 叶乘风 阅读(111) 评论(0) 推荐(0)
摘要:2024-03-06 NestJs学习日志之跨域新建一个跨域中间件(如:cors.middleware.ts),并把它导入到项目根目录的app.modules.ts里面使用。 中间件代码如下: import { Injectable, NestMiddleware } from "@nestjs/common"; @Injectable() // 阅读全文
posted @ 2024-03-06 11:28 叶乘风 阅读(154) 评论(0) 推荐(0)
摘要:2024-03-06 NestJs学习日志之新建nest项目,运行启动命令nest start报错:Could not find TypeScript configuration file "tsconfig.json". ==》你应该在nest项目里面运行启动命令,而不是其他的目录如题,低级错误。具体报错: Could not find TypeScript configuration file "tsconfig.json". Please, ensure that you are running this command in the appropriate direct 阅读全文
posted @ 2024-03-06 10:19 叶乘风 阅读(300) 评论(0) 推荐(0)