# mean_project **Repository Path**: notloop/mean_project ## Basic Information - **Project Name**: mean_project - **Description**: MongoDB, Express, AngularJS, Node.js 全栈开发学习 取自于和凌志编著的《全栈开发之道 MongoDB+Express+AngularJS+Node.js》 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-03-07 - **Last Updated**: 2021-02-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # mean_project #### 介绍 MongoDB, Express, AngularJS, Node.js 全栈开发学习 取自于和凌志编著的《全栈开发之道 MongoDB+Express+AngularJS+Node.js》 #### 软件架构 软件架构说明 #### 安装教程 1. xxxx 2. xxxx 3. xxxx #### 使用说明 1. xxxx 2. xxxx 3. xxxx #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 码云特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) 发现问题: ===========测试对angular的局部刷新的使用=============== 1. 关于路径的问题,因为执行时是通过终端执行node命令发起server.js,此时应当认定为程序执行的根路径即为server.js所在文件夹的路径 那么设置静态路径的时候就需要设置一下相对路径,否则无效: app.use(express.static(path.join(__dirname, '../../views'))); 2. 写angularjs的时候,下面的templateUrl写错,导致页面点击始终没有反应 myApp.config(function($routeProvider) { $routeProvider.when('/', { templateUrl: '/partRefresh/home.html', controller: 'mainController' }) .when('/about', { templateUrl: '/partRefresh/about.html', controller: 'aboutController' }) .when('/contact', { templateUrl: '/partRefresh/contact.html', controller: 'contactController' }); }); 3. ng-model 不要错写成 ng-module 4. angular.js报错 Argument 'TodoController' is not a function, got undefined 原因是版本问题,从1.3.x之后就不支持全局定义的controller函数, 错误写法:views\ng-case-5-controller.html 正确写法:views\ng-case-4-module.html =======================mongodb简单使用============================= 注:在MongoDB中,多个文档组成集合,多个集合组成数据库,相当于 一个数据库就是一个文件,需要注意,数据库名是区分大小写的,为简单起见,数据库名全部用小写 5. 安装数据库时,不要选择install compass,否则安装特别慢 6. schema创建的对象user的时候,最后exports的时候,第一个参数为集合的名字, 如果没有加“s”,会默认加上s,比如下面写的“User”,表示将数据保存到指定数据库的“Users”的集合中去 module.exports = mongoose.model('User', UserSchema); ==================用户管理系统============================ 7. path.join(__dirname, xxx) 和 __dirmname + xxx 第二种方式要前面要加"/" 8. 设置controller时,后面函数体几个参数写法要注意,否则会报错undefined myApp.controller('AppCtrl', ['$scope', '$http', function($scope, $http) { $http.get('/contactList').success(function(response) { console.log("I get the data from my request"); $scope.contactList = response; }); }]); 9. 使用mongojs连接MongoDB时,连接时很多写法现在不都支持了 var mongojs = require('mongojs'); //var db = require('mongojs').connect(databaseUrl, collections); 该写法不支持connect方法,会undefined var db = mongojs("mongodb://localhost:27017/local"); 此处可以直接写成mongojs("local");