Angularjs 模块化应用程序的好方法是什么?
我正在开始开发MEAN应用程序,并尝试使用适当的方法来管理我的工作流程和代码组织。我目前正在使用Gulp进行自动化,使用Bower进行客户端包管理。 我当前的目录结构如下所示:Angularjs 模块化应用程序的好方法是什么?,angularjs,node.js,mean-stack,Angularjs,Node.js,Mean Stack,我正在开始开发MEAN应用程序,并尝试使用适当的方法来管理我的工作流程和代码组织。我目前正在使用Gulp进行自动化,使用Bower进行客户端包管理。 我当前的目录结构如下所示: . /app # welcome to the server /models # Mongoose models are here /routes # API routing is here /config # server side config fi
.
/app
# welcome to the server
/models
# Mongoose models are here
/routes
# API routing is here
/config
# server side config files here (init.js and passport.js)
/node_modules
# this one is obvious
/public
# Angular is rocking over here
/app
app.js
app.routes.js # this one is getting quite bloated
/controllers
# angular controllers
/services
# angular services
/views
index.html
/pages
# here I have directories for the views belonging to certain models
/assets
/css
/img
/js
/libs
/dist
# gulp outputs compiled and/or minified CSS & JS here
我的问题是:我试过MeanJS和MEAN.io,虽然我觉得这些设置的开销太大,但我喜欢的是整个应用程序都是模块化的,每个模块都位于/packages
中自己的目录中,在该目录中有自己的客户端和服务器端代码
我知道这很容易成为一个观点多于事实的问题,但我真的想知道模块化应用程序的最佳方法是什么,从而封装某些功能,使它们可能可重用和可插拔
提前谢谢你 另外,让我补充一点,我也想知道什么是将测试集成到这些模块中的正确方法。我已经写了一篇关于应用程序结构的博客文章。也许这对你有帮助。