Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
deps: upgrade koa-onerror to 2.0.0 (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 authored and dead-horse committed Jul 4, 2016
1 parent f49a6aa commit 3be6f96
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 57 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sudo: false
language: node_js
node_js:
- '4'
- '6'
install:
- npm i npminstall && npminstall
script:
- npm test
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
The MIT License (MIT)

Copyright (c) 2014 dead_horse
Copyright (c) 2015 - 2016 cnpm and other contributors.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
8 changes: 0 additions & 8 deletions Makefile

This file was deleted.

54 changes: 35 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
koa-middlewares
===============

[![Dependency Status](https://gemnasium.com/cnpm/koa-middlewares.svg)](https://gemnasium.com/dead-horse/koa-middlewares)
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/koa-middlewares.svg?style=flat
[npm-url]: https://npmjs.org/package/koa-middlewares
[travis-image]: https://img.shields.io/travis/cnpm/koa-middlewares.svg?style=flat
[travis-url]: https://travis-ci.org/cnpm/koa-middlewares
[david-image]: https://img.shields.io/david/cnpm/koa-middlewares.svg?style=flat
[david-url]: https://david-dm.org/cnpm/koa-middlewares
[snyk-image]: https://snyk.io/test/npm/koa-middlewares/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/koa-middlewares
[download-image]: https://img.shields.io/npm/dm/koa-middlewares.svg?style=flat-square
[download-url]: https://npmjs.org/package/koa-middlewares

easy way to use some small but useful koa middlewares.

**PRs** are welcome, but only for those small and general middlewares.

## install

```
```bash
npm install koa-middlewares --save
```

Expand Down Expand Up @@ -64,7 +79,7 @@ app.listen(7001);
* **koa-bodyparser**: post body parser,
for `application/json` and `application/x-www-form-urlencoded`.

```
```js
app.use(middlewares.bodyParser({
limit: '10mb'
}));
Expand All @@ -76,7 +91,7 @@ app.use(function *(next) {

* **koa-csrf**: CSRF tokens.

```
```js
middlewares.csrf(app);
app.use(function *checkCsrf(next) {
if (this.method === 'GET' ||
Expand All @@ -92,7 +107,7 @@ app.use(function *checkCsrf(next) {

* **koa-ejs**: ejs view render middleware. support all feature of ejs.

```
```js
middlewares.render(app, {
root: path.join(__dirname, 'view')
});
Expand All @@ -106,20 +121,20 @@ app.use(function *() {
* **koa-conditional-get**: HTTP response freshness testing middleware base on node-fresh.
use it upstream from etag.

```
```js
app.use(middlewares.conditional());
app.use(middlewares.etag());
```

* **koa-favicon**: Bounce favicon requests with a 404.

```
```js
app.use(middlewares.favicon());
```

* **koa-safe-jsonp**: A safe jsonp plugins for koa.

```
```js
middlewares.jsonp(app);

app.use(function* () {
Expand All @@ -129,21 +144,21 @@ app.use(function* () {

* **koa-logger**: Development style logger.

```
```js
app.use(middlewares.logger());
```

* **koa-session**: cookie base session.

```
```js
app.use(middlewares.cookieSession());
```

* **koa-generic-session**: A session like connect with memory,
has friendly APIs for work with other Stores such as `redis`, `mongo`.
* **koa-redis**: Work togather with `koa-generic-session`, provide a redis store from koa-sess.

```
```js
app.use(middlewares.session({
store: middlewares.RedisStore(),
defer: true
Expand All @@ -158,7 +173,7 @@ app.use(function *() {

* **koa-router**: Provide express-style routing using app.get, app.put, app.post.

```
```js
app.use(middlewares.router(app));
app.get('/', function *() {
this.body = 'Hello koa-router';
Expand All @@ -167,7 +182,7 @@ app.get('/', function *() {

* **koa-resource-router**: RESTful resource routing for koa.

```
```js
var users = new middlewares.Resource('users');
app.use(users.middleware());

Expand All @@ -178,13 +193,13 @@ app.get('/users', function *() {

* **koa-rewrite**: URL rewrite middleware.

```
```js
app.use(middlewares.rewrite('/js/*', '/public/assets/js/$1'));
```

* **koa-rt**: Log response time, support custom with microtime.

```
```js
var microtime = require('microtime');
app.use(middlewares.rt({
timer: microtime
Expand All @@ -193,7 +208,7 @@ app.use(middlewares.rt({

* **koa-static-cache**: Static file serving from memory.

```
```js
app.use(middlewares.staticCache(path.join(__dirname, 'public'), {
buffer: true,
maxAge: 60 * 60 * 24 * 7,
Expand All @@ -203,7 +218,7 @@ app.use(middlewares.staticCache(path.join(__dirname, 'public'), {

* **koa-compress**: Compress middleware for Koa, support `gzip` and `deflate`

```
```js
var app = koa()
app.use(compress({
threshold: 2048,
Expand All @@ -213,10 +228,11 @@ app.use(compress({

* **koa-onerror**: Error handler

```
```js
var app = koa()
onerror(app);
```

## License
MIT

[MIT](LICENSE)
16 changes: 3 additions & 13 deletions example.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
/*!
* koa-middlewares - example.js
* Copyright(c) 2014 dead_horse <[email protected]>
* MIT Licensed
*/

'use strict';

/**
* Module dependencies.
*/

var koa = require('koa');
var middlewares = require('./');
const koa = require('koa');
const middlewares = require('./');

var app = koa();
const app = koa();

app.use(middlewares.bodyParser());
app.use(middlewares.gzip({minLength: 100}));
Expand Down
10 changes: 0 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
/*!
* koa-middlewares - index.js
* Copyright(c) 2014 dead_horse <[email protected]>
* MIT Licensed
*/

'use strict';

/**
* Module dependencies.
*/

exports.resourceRouter = exports.ResourceRouter = require('koa-resource-router');
exports.bodyparser = exports.bodyParser = require('koa-bodyparser');
exports.redisStore = exports.RedisStore = require('koa-redis');
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"description": "easy way to require some useful koa middlewares",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node index.js"
},
"repository": {
"type": "git",
"url": "git://github.com/dead-horse/koa-middlewares.git"
"url": "git://github.com/cnpm/koa-middlewares.git"
},
"keywords": [
"koa",
Expand All @@ -21,9 +21,9 @@
"author": "dead_horse <[email protected]> (http://deadhorse.me)",
"license": "MIT",
"bugs": {
"url": "https://github.com/dead-horse/koa-middlewares/issues"
"url": "https://github.com/cnpm/koa-middlewares/issues"
},
"homepage": "https://github.com/dead-horse/koa-middlewares",
"homepage": "https://github.com/cnpm/koa-middlewares",
"dependencies": {
"koa-bodyparser": "^2.0.1",
"koa-compress": "^1.0.9",
Expand All @@ -34,7 +34,7 @@
"koa-favicon": "^1.2.1",
"koa-generic-session": "^1.10.2",
"koa-logger": "^1.3.0",
"koa-onerror": "^1.3.1",
"koa-onerror": "^2.0.0",
"koa-redis": "^2.0.1",
"koa-resource-router": "^0.4.0",
"koa-rewrite": "^1.1.1",
Expand All @@ -45,8 +45,8 @@
"koa-static-cache": "^3.1.7"
},
"devDependencies": {
"autod": "^2.5.1",
"koa": "^1.2.0"
"autod": "2",
"koa": "1"
},
"files": [
"index.js"
Expand Down

0 comments on commit 3be6f96

Please sign in to comment.