win7+NodeJS+MongoDB+Smart Table
来源:互联网 发布:八卦九宫打法优化版 编辑:程序博客网 时间:2024/06/16 10:25
一 NodeJS
1.http://nodejs.org/ 下载最新V6.10.0 LTS, 双击安装
2.cmd命令行到安装目录,安装express,运行 D:\nodejs>npm install -g express-generator
-g 表示全局安装
3.创建express项目,如 express -e nodetest
-e 表示使用ejs模板 或 --view==ejs
4.安装,到 nodetest 目录 运行 npm install
5.启动 npm start, 查看 http://localhost:3000/
二 MongoDB
1.https://www.mongodb.com下载3.2.8, mongodb-win32-i386-3.2.8-signed (64位处理器请下载64位安装包).
访问不了网站的,请到其他正规网站下. 我是通过公司网络下的.
2.设置log文件和db目录,在bin目录同级创建data目录,再在data目录创建log和db目录
mongod --logpath="D:\Program Files\MongoDB\Server\3.2\data\log\log.txt" --dbpath="D:\Program Files\MongoDB\Server\3.2\data\db"
3.Hotfix KB2731284 or later update is not installed问题
到https://support.microsoft.com/zh-cn/hotfix/kbhotfix?kbnum=2731284&kbln=zh-cn, 填写邮箱
微软会发一个补丁下载路径的邮件,根据连接地址下载安装补丁,我的是32位的
http://hotfixv4.microsoft.com/Windows%207/Windows%20Server2008%20R2%20SP1/sp2/Fix405791/7600/free/451412_intl_i386_zip.exe
64位的
http://hotfixv4.microsoft.com/Windows%207/Windows%20Server2008%20R2%20SP1/sp2/Fix405791/7600/free/451413_intl_x64_zip.exe
4. log里提示错误 "The default storage engine 'wiredTiger' is not available"
加上参数 --storageEngine=mmapv1
5. 查看http://localhost:27017/
显示 It looks like you are trying to access MongoDB over HTTP on the native driver port.
6. 创建windows服务
mongod --install --logpath="D:\Program Files\MongoDB\Server\3.2\data\log\log.txt" --dbpath="D:\Program Files\MongoDB\Server\3.2\data\db" --storageEngine=mmapv1
services.msc命令查看mongodb服务是否创建成功
若log里提示"Error connecting to the Service Control Manager",请用管理员身份运行cmd命令行,再执行上面的命令.
三、Angular+Smart Table
1. 下载 AngularJs1.0 到 https://angularjs.org/
最新版本是1.6.3
2. 下载 Smart Table
在nodetest目录运行: npm install angular-smart-table
安装完后可以在 ./node_modules/angular-smart-table/dist 找到相关的 js 文件
将smart-table.min.js拷贝到目录 ./public/javascripts/smarttable下,目录如果不存在请自行创建
3. 在目录 public/javascripts/ 下创建文件 table.js, 数据可以改成从 MongoDB获取
var app = angular.module('myApp',['smart-table']);
app.controller('basicsCtrl', ['$scope', function (scope) {
scope.rowCollection = [
{firstName: 'Laurent', lastName: 'Renard', birthDate: new Date('1987-05-21'), balance: 102, email: 'whatever@gmail.com'},
{firstName: 'Blandine', lastName: 'Faivre', birthDate: new Date('1987-04-25'), balance: -2323.22, email: 'oufblandou@gmail.com'},
{firstName: 'Francoise', lastName: 'Frere', birthDate: new Date('1955-08-27'), balance: 42343, email: 'raymondef@gmail.com'}
];
}]);
4. 在 views目录下创建文件 table.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel='stylesheet' href='/stylesheets/bootstrap.min.css'/>
</head>
<body>
<div ng-app="myApp" class="main_table">
<div ng-controller="basicsCtrl">
<table st-table="rowCollection" class="table table-striped">
<thead>
<tr>
<th>first name</th>
<th>last name</th>
<th>birth date</th>
<th>balance</th>
<th>email</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in rowCollection">
<td>{{row.firstName}}</td>
<td>{{row.lastName}}</td>
<td>{{row.birthDate}}</td>
<td>{{row.balance}}</td>
<td>{{row.email}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<script src="javascripts/angular/1.6.3/angular.min.js"></script>
<script src='javascripts/smarttable/smart-table.min.js'></script>
<script src="javascripts/table.js"></script>
</body>
</html>
Note: 自行下载css文件 bootstrap.min.css
5. 修改 app.js
加一行
app.use('/table',index);
6.修改 index.js, 加入下面代码
router.get('/table', function(req, res, next) {
res.render('table', { title: 'test table' });
});
- win7+NodeJS+MongoDB+Smart Table
- cell smart table scan
- mongodb--nodejs
- mongodb+nodejs
- nodejs+mongodb
- win7+mongodb
- [MongoDB]win7安装mongodb
- Nodejs 邂逅 Mongodb
- nodejs mongodb monq
- nodejs/express+mongodb/mongoose
- nodejs mongodb (2)
- nodejs+mongodb+aliyun+nginx
- nodejs mongoDB 视频教程
- nodejs操作mongodb
- NodeJs+Mongodb用法
- Nodejs mongoose操作mongodb
- nodejs直接操作mongodb
- angular+nodejs+mongodb架构
- WordPress主题 Tob 自适应响应式小清新无限加载图片主题[更新v0.3]
- 顺序队列 - 循环队列 - 链队列
- php笔试题
- 2016.08.14【初中部 NOIP提高组 】模拟赛C题目
- 【Linux】PCB(进程控制块)--‘task_struct’
- win7+NodeJS+MongoDB+Smart Table
- Java栈数据结构的实现方式
- SQL Server无法远程连接
- 2016-8-14 笔记
- setPageTransformer几个特效
- 实习问题小总结
- 二叉树相关面试题目之实例总结
- A. Launch of Collider
- Map集合