ee-core icon indicating copy to clipboard operation
ee-core copied to clipboard

[feat] 新增 koa 静态服务支持 & HttpServer 自定义 filter 请求过滤器

Open CcSimple opened this issue 7 months ago • 0 comments

可配置 是否启用 静态服务 以及自定义 请求过滤

{
  httpServer: {
  static: {
    enable: true,
    prefix: '/public',
    path: path.join(getExtraResourcesDir(), 'public'),
    options: {}
  },
  filter: (uriPath, ctx) => {
     if (uriPath.startsWith('/public')) {
        return true;
      }
      if (uriPath == 'ee') {
        ctx.response.body  = 'hello ee'
        return true;
      }
      return false;
  },
}}

CcSimple avatar Jun 11 '25 04:06 CcSimple