Angular 5 小型项目的项目结构
Angular 5 project structure for small project
我阅读了一些关于构建项目文件夹的文章和文档。
如果我没记错的话推荐的结构是这样的:
- 共享模块
- 核心模块
- 功能模块
我的应用程序很小,大约有 8 个模型,服务数量相同,只有 4 个视图(login/register,身份验证后应用程序中接下来的 3 个)。
对于像我这样的小项目,遵循关于这 3 种类型模块的约定是否有意义?
我考虑以下结构:
- 组件
- 观看次数
- 服务
- 型号
- 拦截器
- ...
你怎么看?也可以吗,还是我应该遵循推荐的?感谢您的回答。
恕我直言,您不应该浪费时间考虑您还没有的需求。如果您看不到该项目的发展超出了某个点,请按照您认为合适的方式保留结构。
对于更大的项目,我建议查看 nx-project how they structure their apps (all modules are an own lib, so there is only the core module that stands out and bootstraps the rest of the app) and Manfred Steyer's slides on Enterprise Architecture in Angular: https://github.com/manfredsteyer https://speakerdeck.com/manfredsteyer/angular-application-architecture-npm-packages-monorepos-and-microservices-nghamburg-march-2018
我阅读了一些关于构建项目文件夹的文章和文档。
如果我没记错的话推荐的结构是这样的:
- 共享模块
- 核心模块
- 功能模块
我的应用程序很小,大约有 8 个模型,服务数量相同,只有 4 个视图(login/register,身份验证后应用程序中接下来的 3 个)。 对于像我这样的小项目,遵循关于这 3 种类型模块的约定是否有意义?
我考虑以下结构:
- 组件
- 观看次数
- 服务
- 型号
- 拦截器
- ...
你怎么看?也可以吗,还是我应该遵循推荐的?感谢您的回答。
恕我直言,您不应该浪费时间考虑您还没有的需求。如果您看不到该项目的发展超出了某个点,请按照您认为合适的方式保留结构。
对于更大的项目,我建议查看 nx-project how they structure their apps (all modules are an own lib, so there is only the core module that stands out and bootstraps the rest of the app) and Manfred Steyer's slides on Enterprise Architecture in Angular: https://github.com/manfredsteyer https://speakerdeck.com/manfredsteyer/angular-application-architecture-npm-packages-monorepos-and-microservices-nghamburg-march-2018