egg-serverless-inner-auth
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

使用

  • 1、在plugin启用插件
 innerAuth: {
      enable: true,
      package: 'egg-serverless-inner-auth',
  },
  • 2、参数配置
config.serverlessInnerAuth = {
    //需要验证的前缀
    prefix: "inner",
    //密钥
    secret: "",
    //内网域名
    host: "http://localhost",
    //有效时长(s)
    expire: 10,
    //返回状态码
    status: 200,
    //返回信息
    message: '内部错误',
    //返回信息内的code
    code: 1001
};
  • 3、启用中间件
// 中间件
config.middleware = ['innerAuthority'];
  • 4、调用请求方法
//域名及前缀都在配置里,如请求 http://127.0.0.1/inner/order
const data = await this.app.innerRequest('/order', {}) 

Package Sidebar

Install

npm i egg-serverless-inner-auth

Weekly Downloads

23

Version

1.2.1

License

MIT

Unpacked Size

8.73 kB

Total Files

8

Last publish

Collaborators

  • pcyang