-1

这段代码是否因为有副作用而破坏了 SOLID 原则和不良做法??

var app = exports = module.exports = {};
app.prototype = Object.create(expressApp.prototype);

app.config = function config() {
    this.set("trust proxy", true);
    this.use(someMiddleware)
    this.use(json());
}

我会这样使用它

const {app} = require('file')

app.config()

而不是一遍又一遍地复制和粘贴相同的代码

4

0 回答 0