Skip to content

请问如何使用JavaScript Plugin,能否提供一个示例? #178

Closed
@helloworld8192

Description

@helloworld8192

尝试在后台添加JavaScript类型的plugin,内容如下:

function NewPlugin(cfg) {
  // import builtin modules
  var JSON = require("json")
  var HTTP = require("http")
  var REDIS = require("redis")
  var LOG = require("log")
  // init plugin
  return {
    // filter pre method
    "pre": function(ctx) {
  return {"code": 403, "error": "not login"}
    }
  }
}

但是没有效果,请求还是被正常转发
能否提供一个plugin_js的示例,谢谢!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions