Skip to content

Commit

Permalink
update to v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jackhutu committed Apr 10, 2016
1 parent c0eb363 commit b12b009
Show file tree
Hide file tree
Showing 28 changed files with 651 additions and 604 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ addons:

services:
- mongodb
- redis-server

before_install:
- $CXX --version
Expand Down
9 changes: 9 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
1.3.0 / 2016-04-10
==================

* 更新依赖包到最新
* 增加redis支持
* 使用connect-redis 替换 connect-mongo
* 使用redis 缓存首页图片列表.


1.2.1 / 2016-01-28
==================

Expand Down
3 changes: 1 addition & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

SOFTWARE.
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

[![build status][travis-image]][travis-url]
[![Coverage Status][coveralls-image]][coveralls-url]
[![Dependency Status](https://david-dm.org/jackhutu/jackblog-api-express.svg)](https://david-dm.org/jackhutu/jackblog-api-express)
[![devDependency Status](https://david-dm.org/jackhutu/jackblog-api-express/dev-status.svg)](https://david-dm.org/jackhutu/jackblog-api-express#info=devDependencies)

[travis-image]: https://travis-ci.org/jackhutu/jackblog-api-express.svg?branch=master
[travis-url]: https://travis-ci.org/jackhutu/jackblog-api-express
Expand All @@ -10,21 +12,17 @@
[coveralls-url]: https://coveralls.io/github/jackhutu/jackblog-api-express?branch=master

## 简介
Jackblog 是使用 Node.js + MongoDB + 其它客户端框架, 开发的个人博客系统,前后端分离,仿简书模板.此为服务端express版.
服务端有:
[express版](https://github.com/jackhutu/jackblog-api-express)
[koa版](https://github.com/jackhutu/jackblog-api-koa)
客户端有:
[angular1.x版](https://github.com/jackhutu/jackblog-angular1)
[react redux 版](https://github.com/jackhutu/jackblog-react-redux)
[vue 版](https://github.com/jackhutu/jackblog-vue)
移动端有:
[react native 版](https://github.com/jackhutu/jackblog-react-native-redux)
Jackblog 是使用 Node.js + MongoDB + Redis + 其它客户端框架开发的个人博客系统,前后端分离,仿简书模板.
服务端有: [express 版](https://github.com/jackhutu/jackblog-api-express) , [koa 版](https://github.com/jackhutu/jackblog-api-koa)
客户端有: [angular1.x 版](https://github.com/jackhutu/jackblog-angular1) , [angular2.x 版](https://github.com/jackhutu/jackblog-angular2) , [react redux 版](https://github.com/jackhutu/jackblog-react-redux) , [vue 版](https://github.com/jackhutu/jackblog-vue)
移动端有: [react native 版](https://github.com/jackhutu/jackblog-react-native-redux), [ionic2.0 版](https://github.com/jackhutu/jackblog-ionic2)
##### 此为服务端Express版, 为客户端提供api.

## 环境准备
```
node.js 4.0+
mognodb 3.0+
redis 2.8+
```

## 配置
Expand All @@ -40,27 +38,30 @@ mognodb 3.0+
},
```


## 开发
```
$ git clone git@github.com:jackhutu/jackblog-api-express.git
$ cd jackblog-api-express
$ npm install
$ gulp serve
```
配合客户端测试的测试模式

```
$ gulp serve:test
```

## 线上布署
```
$ pm2 start process.json
```
可参考[利用git和pm2一键布署项目到vps](http://angular1.jackhu.top/article/55cd8e00c6e998b817a930c7)
可参考[利用git和pm2一键布署项目到vps](http://jackhu.top/article/55cd8e00c6e998b817a930c7)

## 测试
```
$ gulp test
```
配合客户端测试的测试模式

```
$ gulp serve:test
```

## License
MIT
1 change: 0 additions & 1 deletion gulp/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ exports.paths = {
istanbul: 'test_coverage',
server:'server'
};

/**
* 错误处理
*/
Expand Down
52 changes: 25 additions & 27 deletions gulp/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,38 @@ var nodemon = require('gulp-nodemon');

//默认development模式
gulp.task('nodemon',function () {
nodemon({
script: path.join(config.paths.server,'/app.js'),
ext: 'js',
watch: [
path.join(config.paths.server,'/')
]
})
nodemon({
script: path.join(config.paths.server,'/app.js'),
ext: 'js',
watch: [
path.join(config.paths.server,'/')
]
})
});
//test模式
gulp.task('nodemon:test',function () {
//http://localhost:8080 test mode
nodemon({
script: path.join(config.paths.server,'/app.js'),
ext: 'js json',
watch: [
path.join(config.paths.server,'/')
],
env: { 'NODE_ENV': 'test' }
})
//http://localhost:8080 test mode
nodemon({
script: path.join(config.paths.server,'/app.js'),
ext: 'js json',
watch: [
path.join(config.paths.server,'/')
],
env: { 'NODE_ENV': 'test' }
})
});
//production模式
gulp.task('nodemon:production',function () {
nodemon({
script: path.join(config.paths.server,'/app.js'),
ext: 'js json',
watch: [
path.join(config.paths.server,'/')
],
env: { 'NODE_ENV': 'production' }
})
nodemon({
script: path.join(config.paths.server,'/app.js'),
ext: 'js json',
watch: [
path.join(config.paths.server,'/')
],
env: { 'NODE_ENV': 'production' }
})
});


gulp.task('serve',['nodemon']);
gulp.task('serve:test',['nodemon:test']);
gulp.task('serve:production',['nodemon:production']);

gulp.task('serve:production',['nodemon:production']);
82 changes: 41 additions & 41 deletions gulp/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,62 +11,62 @@ var coveralls = require('gulp-coveralls');

//设置环境变量,mocha,istanbul测试必须在test mode
gulp.task('set-env', function () {
env({
vars: {
'NODE_ENV':'test'
}
});
env({
vars: {
'NODE_ENV':'test'
}
});
});
//istanbul
gulp.task('pre-test', function () {
return gulp.src([
path.join(config.paths.server,'/**/*.js'),
path.join('!' + config.paths.server,'/config/**/*.js'),
path.join('!' + config.paths.server,'/auth/**/*.js'),
path.join('!' + config.paths.server,'/{app,routes}.js'),
path.join('!' + config.paths.server,'/model/**/*.js')
])
.pipe(istanbul()) // Covering files
.pipe(istanbul.hookRequire())
path.join(config.paths.server,'/**/*.js'),
path.join('!' + config.paths.server,'/config/**/*.js'),
path.join('!' + config.paths.server,'/auth/**/*.js'),
path.join('!' + config.paths.server,'/{app,routes}.js'),
path.join('!' + config.paths.server,'/model/**/*.js')
])
.pipe(istanbul()) // Covering files
.pipe(istanbul.hookRequire())
});

gulp.task('test:istanbul',['set-env','pre-test'],function () {

gulp.src(path.join(config.paths.mocha,'/**/*.test.js'),{read: false})
.pipe(mocha({
require: ['should'],
timeout: 5000
}))
.pipe(istanbul.writeReports({
dir: path.join(config.paths.istanbul,'/')
}))
.once('error', function () {
process.exit(1);
})
.once('end', function () {
process.exit();
});
gulp.src(path.join(config.paths.mocha,'/**/*.test.js'),{read: false})
.pipe(mocha({
require: ['should'],
timeout: 5000
}))
.pipe(istanbul.writeReports({
dir: path.join(config.paths.istanbul,'/')
}))
.once('error', function () {
process.exit(1);
})
.once('end', function () {
process.exit();
});

});
//mocha test
gulp.task('test:mocha',['set-env'],function () {
gulp.src(path.join(config.paths.mocha,'/**/*.test.js'),{read: false})
.pipe(mocha({
reporter: 'list', //list,nyan,spec(default),progress
require: ['should'],
timeout: 5000
}))
.once('error', function () {
process.exit(1);
})
.once('end', function () {
process.exit();
});
gulp.src(path.join(config.paths.mocha,'/**/*.test.js'),{read: false})
.pipe(mocha({
reporter: 'list', //list,nyan,spec(default),progress
require: ['should'],
timeout: 5000
}))
.once('error', function () {
process.exit(1);
})
.once('end', function () {
process.exit();
});
});
//coveralls
gulp.task('coveralls',function () {
gulp.src(path.join(config.paths.istanbul, '/lcov.info'))
.pipe(coveralls());
gulp.src(path.join(config.paths.istanbul, '/lcov.info'))
.pipe(coveralls());
});

gulp.task('test',gulpSequence('test:istanbul'));
6 changes: 3 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ var gulp = require('gulp');
var fs = require('fs');

fs.readdirSync('./gulp').forEach(function (file) {
if((/\.(js|coffee)$/i).test(file)){
require('./gulp/' + file);
}
if((/\.(js|coffee)$/i).test(file)){
require('./gulp/' + file);
}
});

gulp.task('default', ['serve']);
63 changes: 30 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jackblog-api-express",
"version": "1.2.1",
"version": "1.3.0",
"description": "Jackblog API Express版",
"main": "server/app.js",
"scripts": {
Expand All @@ -23,49 +23,46 @@
},
"homepage": "https://github.com/jackhutu/jackblog-api-express#readme",
"dependencies": {
"bluebird": "^2.10.2",
"body-parser": "^1.14.1",
"bunyan": "^1.5.1",
"bluebird": "^3.3.4",
"body-parser": "^1.15.0",
"bunyan": "^1.8.0",
"ccap": "^0.6.4",
"composable-middleware": "^0.3.0",
"compression": "^1.6.0",
"connect-mongo": "^0.8.2",
"cookie-parser": "^1.4.0",
"compression": "^1.6.1",
"connect-redis": "^3.0.2",
"cookie-parser": "^1.4.1",
"cors": "^2.7.1",
"errorhandler": "^1.4.2",
"express": "^4.13.3",
"express-jwt": "^3.1.0",
"express-session": "^1.12.0",
"jsonwebtoken": "^5.4.0",
"lodash": "^3.10.1",
"markdown-it": "^5.0.0",
"errorhandler": "^1.4.3",
"express": "^4.13.4",
"express-jwt": "^3.3.0",
"express-session": "^1.13.0",
"ioredis": "^1.15.1",
"jsonwebtoken": "^5.7.0",
"lodash": "^4.9.0",
"markdown-it": "^6.0.1",
"method-override": "^2.3.5",
"moment": "^2.10.6",
"mongoose": "^4.2.2",
"moment": "^2.12.0",
"mongoose": "^4.4.12",
"multer": "^1.1.0",
"passport": "^0.3.0",
"passport-github": "^1.0.0",
"passport": "^0.3.2",
"passport-github": "^1.1.0",
"passport-local": "^1.0.0",
"passport-qq": "0.0.3",
"passport-weibo": "^0.1.2",
"pm2": "^0.15.7",
"qiniu": "^6.1.8"
"pm2": "^1.1.1",
"qiniu": "^6.1.9"
},
"devDependencies": {
"del": "^2.0.2",
"gulp": "^3.9.0",
"gulp": "^3.9.1",
"gulp-coveralls": "^0.1.4",
"gulp-env": "^0.2.0",
"gulp-istanbul": "^0.10.2",
"gulp-mocha": "^2.1.3",
"gulp-nodemon": "^2.0.4",
"gulp-sequence": "^0.4.1",
"gulp-env": "^0.4.0",
"gulp-istanbul": "^0.10.4",
"gulp-mocha": "^2.2.0",
"gulp-nodemon": "^2.0.6",
"gulp-sequence": "^0.4.5",
"gulp-util": "^3.0.7",
"mocha": "^2.3.3",
"nock": "^2.15.0",
"should": "^7.1.1",
"should-promised": "^0.3.1",
"sinon": "^1.17.2",
"supertest": "^1.1.0"
"should": "^8.3.0",
"sinon": "^1.17.3",
"supertest": "^1.2.0"
}
}
Loading

0 comments on commit b12b009

Please sign in to comment.