keystonejs/keystone-classic
在 GitHub 查看Provide hostname etc from request to schemaplugins and hooks
Open
#3,187 创建于 2016年7月21日
help wantedneeds input
描述
I need to write a mongoose plugin. where I need a Request object to find hostname.
module.exports = exports = function(schema, options) {
schema.add({
hostname: String
})
schema.pre('save', true, function(next, done) {
this.hostname = req.headers.host; //need request object
next();
setTimeout(done, 100);
});
}
I have raised related question in stackoverflow