@bbyy/vera
A web framework based egg.js
Last updated 10 months ago by hbshun .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @bbyy/vera 
SYNC missed versions from official npm registry.

Vera

A web framework extends Egg.js

Usage

npm i -S @bbyy/vera
# package.json
"egg": {
  "framework": "@bbyy/vera"
}

插件

清单

名称 node_modules enable
ejs egg-view-ejs true
ue @bbyy/egg-ue true
io egg-socket.io false
redis egg-redis false
sessionRedis egg-session-redis false

默认配置

// plugin.js
module.exports = {
  ejs: {
    enable: true,
    package: 'egg-view-ejs',
  },
  ue: {
    enable: true,
    package: '@bbyy/egg-ue',
  },
  io: {
    enable: false,
    package: 'egg-socket.io',
  },
  redis: {
    enable: false,
    package: 'egg-redis',
  },
  sessionRedis: {
    enable: false,
    package: 'egg-session-redis',
  },
};

// config.default.js
module.exports = () => {
  const config = {
    siteFile: {
      '/favicon.ico': readFileSync(join(__dirname, 'favicon.png')),
    },
    httpclient: {
      request: {
        timeout: [ 30000, 600000 ],
      },
    },
    io: {
      namespace: {
        '/': {
          connectionMiddleware: [],
          packetMiddleware: [],
        },
      },
      redis: {
        host: '127.0.0.1',
        port: 6379,
        auth_pass: '',
        db: 0,
      },
    },
    redis: {
      client: {
        host: '127.0.0.1',
        port: 6379,
        password: '',
        db: 0,
      },
    },
  };

  return config;
};

继承自egg

插件

  • onerror
  • session
  • i18n
  • watcher
  • multipart
  • security
  • development
  • logrotator
  • schedule
  • static
  • view
  • jsonp

中间件

  • meta
  • siteFile
  • notfound
  • bodyParser
  • overrideMethod

Questions & Suggestions

Please open an issue here.

参考

@bbyy/egg-ue

ctx.helper

// urlconcat
ctx.helper.urlconcat('http://localhost:8080/', 'api/search', 'something', '?a=b&b=c')
// http://localhost:8080/api/search/something?a=b&b=c

// pagination

// uuid
ctx.helper.uuid.v4()
ctx.helper.uuid.v1()

// lodash
ctx.helper._.pick
ctx.helper._.assign
...

// xor
ctx.helper.xor([ 2, 1, 3 ], [ 2, 4, 6, 1 ]);
// {toDel: [3], toAdd: [4, 6]}

// exec
await ctx.helper.exec(`ls ${__dirname}`);
// 执行结果

// password
const originalPassword = '1234';
const hashPassword = await ctx.helper.password.hash(originalPassword);
assert(originalPassword !== hashPassword);
assert(await ctx.helper.password.compare(originalPassword, hashPassword));
assert(!(await ctx.helper.password.compare(originalPassword, hashPassword + '123')));

Current Tags

  • 0.9.0                                ...           latest (10 months ago)

4 Versions

  • 0.9.0                                ...           10 months ago
  • 0.8.0                                ...           10 months ago
  • 0.7.0                                ...           10 months ago
  • 0.4.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (15)
Dev Dependencies (10)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |