Express 和 Angular 目录结构

Express and Angular directory structure

我想用 Express 和 Angular(没有 SQL)建立一个网站,所以我开始想知道这种应用程序的正确结构是什么。

对于 Angular 有一个目录结构我非常喜欢 here:

app/
----- shared/   // acts as reusable components or partials of our site
---------- sidebar/
--------------- sidebarDirective.js
--------------- sidebarView.html
---------- article/
--------------- articleDirective.js
--------------- articleView.html
----- components/   // each component is treated as a mini Angular app
---------- home/
--------------- homeController.js
--------------- homeService.js
--------------- homeView.html
---------- blog/
--------------- blogController.js
--------------- blogService.js
--------------- blogView.html
----- app.module.js
----- app.routes.js
assets/
----- img/      // Images and icons for your app
----- css/      // All styles and style related files (SCSS or LESS files)
----- js/       // JavaScript files written for your app that are not for angular
----- libs/     // Third-party libraries such as jQuery, Moment, Underscore, etc.
index.html

对于Express,我真的不知道它应该放在哪里,因为我没有很多使用Express的经验,我可以把具有正确结构的express放在哪里。

如果您的 express 后端充当 api 服务器,您可以简单地将它与应用的父文件夹并排放置,即

backend/
----gruntfile.js
----express.js
----router/
----package.json
----node_modules/
frontend/
----app/