Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
dead-horse committed Jul 14, 2016
0 parents commit fab05c4
Show file tree
Hide file tree
Showing 14 changed files with 243 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .autod.conf.js
@@ -0,0 +1,22 @@
'use strict';

module.exports = {
write: true,
prefix: '^',
test: [
'test',
'benchmark',
],
devdep: [
'egg-ci',
'egg-bin',
'autod',
'eslint',
'eslint-config-egg',
'supertest',
'should',
],
exclude: [
'./test/fixtures',
],
}
2 changes: 2 additions & 0 deletions .eslintignore
@@ -0,0 +1,2 @@
test/fixtures
coverage
3 changes: 3 additions & 0 deletions .eslintrc
@@ -0,0 +1,3 @@
{
"extends": "eslint-config-egg"
}
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE.md
@@ -0,0 +1,21 @@
<!--
Thank you for reporting an issue.
1. It's RECOMMENDED to submit PR for typo or tiny bug fix.
2. If this's a BUG, please provide: course repetition, error log and configuration. Fill in as much of the template below as you're able.
3. If this's a FEATURE request, please provide: details, pseudo codes if necessary.
感谢您向我们反馈问题。
1. 我们推荐如果是小问题(错别字修改,小的 bug fix)直接提交 PR。
2. 如果是一个 BUG,请提供:复现步骤,错误日志以及相关配置,并尽量填写下面的模板中的条目。
3. 如果是一个新需求,请提供:详细需求描述,最好是有伪代码实现。
-->

* **Node Version**:
* **Egg Version**:
* **Plugin Name**:
* **Plugin Version**:
* **Platform**:

<!-- Enter your issue details below this comment. -->
24 changes: 24 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,24 @@
<!--
Thank you for your pull request. Please review below requirements.
Bug fixes and new features should include tests and possibly benchmarks.
Contributors guide: https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md
感谢您贡献代码。请确认下列 checklist 的完成情况。
Bug 修复和新功能必须包含测试,必要时请附上性能测试。
Contributors guide: https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md
-->

##### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [ ] `npm test` passes
- [ ] tests and/or benchmarks are included
- [ ] documentation is changed or added
- [ ] commit message follows commit guidelines

##### Affected core subsystem(s)
<!-- Provide affected core subsystem(s). -->


##### Description of change
<!-- Provide a description of the change below this comment. -->
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
logs/
npm-debug.log
node_modules/
coverage/
11 changes: 11 additions & 0 deletions .travis.yml
@@ -0,0 +1,11 @@
sudo: false
language: node_js
node_js:
- '4'
- '6'
install:
- npm i npminstall && npminstall
script:
- npm run ci
after_script:
- npm i codecov && codecov
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Alibaba Group Holding Limited 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 the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
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.
52 changes: 52 additions & 0 deletions README.md
@@ -0,0 +1,52 @@
# egg-session

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-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/egg-session.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-session
[travis-image]: https://img.shields.io/travis/eggjs/egg-session.svg?style=flat-square
[travis-url]: https://travis-ci.org/eggjs/egg-session
[codecov-image]: https://codecov.io/github/eggjs/egg-session/coverage.svg?branch=master
[codecov-url]: https://codecov.io/github/eggjs/egg-session?branch=master
[david-image]: https://img.shields.io/david/eggjs/egg-session.svg?style=flat-square
[david-url]: https://david-dm.org/eggjs/egg-session
[snyk-image]: https://snyk.io/test/npm/egg-session/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/egg-session
[download-image]: https://img.shields.io/npm/dm/egg-session.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-session

Session plugin for egg, based on [koa-session](https://github.com/koajs/session).

## Install

```bash
$ npm i egg-session --save
```

## Usage

- plugin.js

```js
exports.session = {
enable: true,
package: 'egg-session',
};
```

## Configuration

Support all configurations in [koa-session](https://github.com/koajs/session).

## Questions & Suggestions

Please open an issue [here](https://github.com/eggjs/egg/issues).

## License

[MIT](LICENSE)
5 changes: 5 additions & 0 deletions app.js
@@ -0,0 +1,5 @@
'use strict';

module.exports = function(app) {
app.config.coreMiddleware.push('session');
};
5 changes: 5 additions & 0 deletions app/middleware/session.js
@@ -0,0 +1,5 @@
'use strict';

module.exports = function(options, app) {
return require('koa-session')(options, app);
};
15 changes: 15 additions & 0 deletions appveyor.yml
@@ -0,0 +1,15 @@
environment:
matrix:
- nodejs_version: '4'
- nodejs_version: '6'

install:
- ps: Install-Product node $env:nodejs_version
- npm i npminstall && npminstall

test_script:
- node --version
- npm --version
- npm run ci

build: off
8 changes: 8 additions & 0 deletions config/config.default.js
@@ -0,0 +1,8 @@
'use strict';

exports.session = {
maxAge: 24 * 3600 * 1000, // ms
key: 'EGG_SESS',
httpOnly: true,
encrypt: true,
};
50 changes: 50 additions & 0 deletions package.json
@@ -0,0 +1,50 @@
{
"name": "egg-session",
"version": "0.0.0",
"description": "session plugin for egg",
"eggPlugin": {
"name": "session"
},
"files": [
"config",
"app",
"app.js",
],
"repository": {
"type": "git",
"url": "git@github.com:eggjs/egg-session.git"
},
"keywords": [
"egg",
"plugin",
"session",
"cookie"
],
"dependencies": {
"koa-session": "^3.3.1"
},
"devDependencies": {
"autod": "^2.6.1",
"egg-bin": "^1.0.2",
"egg-ci": "^1.0.2",
"eslint": "^3.0.1",
"eslint-config-egg": "^3.1.0",
"should": "^9.0.2",
"supertest": "^1.2.0"
},
"engines": {
"node": ">=4.0.0"
},
"scripts": {
"test": "npm run lint && npm run test-local",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint --ext js . --fix",
"ci": "npm run lint && npm run cov",
"autod": "autod"
},
"ci": {
"version": "4, 6"
},
"author": "dead_horse"
}

0 comments on commit fab05c4

Please sign in to comment.