@anyhowstep/ts-route-server
Version:
23 lines • 708 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const schema_1 = require("@anyhowstep/schema");
class SchemaMiddleware {
static Create(name, getMixed, schema) {
if (schema == null) {
return (_req, _res, next) => {
next();
};
}
else {
return (req, res, next) => {
schema_1.SchemaUtil.Fill(name, getMixed(req), schema).then(() => {
next();
}).catch((err) => {
res.status(400).json(err);
});
};
}
}
}
exports.SchemaMiddleware = SchemaMiddleware;
//# sourceMappingURL=SchemaMiddleware.js.map
;