All Projects → eggjs → egg-parameters

eggjs / egg-parameters

Licence: MIT License
Merge all parameters (ctx.params, ctx.request.query, ctx.request.body) into ctx.params like Rails application.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to egg-parameters

Egg Oauth2 Server
🌟 OAuth2 server plugin for egg.js based on node-oauth2-server
Stars: ✭ 174 (+625%)
Mutual labels:  egg, egg-plugin, eggjs
egg-rbac
Role Based Access Control for eggjs
Stars: ✭ 32 (+33.33%)
Mutual labels:  egg, egg-plugin, eggjs
egg-sentry
Sentry Plugin For Egg.js
Stars: ✭ 18 (-25%)
Mutual labels:  egg, egg-plugin, eggjs
Egg 24time
A Twitter-like news and social server for Egg. 微信小程序社区全栈解决方案
Stars: ✭ 493 (+1954.17%)
Mutual labels:  egg, egg-plugin, eggjs
Egg Authz
egg-authz is an authorization middleware for Egg.js based on Casbin
Stars: ✭ 50 (+108.33%)
Mutual labels:  egg, egg-plugin, eggjs
Egg Cancan
cancancan like authorization plugin for Egg.js
Stars: ✭ 47 (+95.83%)
Mutual labels:  egg, egg-plugin, eggjs
Egg Graphql
Stars: ✭ 345 (+1337.5%)
Mutual labels:  egg, egg-plugin, eggjs
Egg Router Plus
The missing router feature for eggjs
Stars: ✭ 117 (+387.5%)
Mutual labels:  egg, egg-plugin, eggjs
Cool Admin Api
cool-admin-api 是基于egg.js、typeorm、jwt等封装的api开发脚手架、快速开发api接口
Stars: ✭ 188 (+683.33%)
Mutual labels:  egg, egg-plugin, eggjs
egg-mailer
🥚 mailer plugin for egg
Stars: ✭ 23 (-4.17%)
Mutual labels:  egg, egg-plugin
egg-exporter
Egg.js 的 Prometheus 指标收集插件,附带 Grafana 看板。
Stars: ✭ 24 (+0%)
Mutual labels:  egg, egg-plugin
egg-kafkajs
☎️kafka plugin for eggjs
Stars: ✭ 26 (+8.33%)
Mutual labels:  egg, egg-plugin
egg-view-react
egg view plugin for react
Stars: ✭ 89 (+270.83%)
Mutual labels:  egg, egg-plugin
egg-kafka-node
kafka plugin for egg.js
Stars: ✭ 36 (+50%)
Mutual labels:  egg, egg-plugin
egg-vue-webpack-dev
基于egg + vue2 + webpack2 的前后端集成开发编译构建插件
Stars: ✭ 29 (+20.83%)
Mutual labels:  egg, egg-plugin
egg-view-assets
Manage frontend assets in development and production.
Stars: ✭ 51 (+112.5%)
Mutual labels:  egg, eggjs
Egg Redis
redis plugin for egg
Stars: ✭ 234 (+875%)
Mutual labels:  egg, egg-plugin
egg-grpc
grpc plugin for egg
Stars: ✭ 79 (+229.17%)
Mutual labels:  egg, egg-plugin
egg-aop
AOP plugin for eggjs, add DI, AOP support.
Stars: ✭ 44 (+83.33%)
Mutual labels:  egg, egg-plugin
egg-session-redis
redis store for egg session
Stars: ✭ 41 (+70.83%)
Mutual labels:  egg, egg-plugin

egg-parameters

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Merge all parameters (ctx.params, ctx.request.query, ctx.request.body) into ctx.params like Rails application.

Configuration

config/plugin.js

exports.parameters = {
  enable: true,
  package: 'egg-parameters',
};

config/config.default.js

exports.parameters = {
  logParameters: true,
  // param names that you want filter in log.
  filterParameters: ['password'],
};

Usage

When you add egg-parameters into your package.json this will enabled by default.

// app/controller/posts.js
module.exports = class {
  /**
   * POST /posts?title=jason&foo=1&user_id=123
   */
  async create() {
    const { ctx } = this;
    const postParam = ctx.params.permit('title', 'body')

    // postParam => { title: '', body: '' }
    // postParam.isPermitted() => true
    // :foo, :user_id will be filted

    // Now you can use safely for egg-sequelize create param
    const post = await ctx.model.Post.create(postParam);
    ctx.body = post;
  }
};
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].