// ПОЧЕМУ super.model ЗДЕСЬ undefined
class A {
constructor() {
// ...
}
method() {
// ...
}
static sMethod() {
// ...
}
}
class B extends A {
constructor(x, y) {
super(x);
super.method(y);
}
}
function A() {
if(!(this instanceof A)) {
throw new Error('Class constructor A cannot be invoked without \'new\'');
}
// ...
}
A.prototype.constructor = A;
A.prototype.method = function method() {
// ...
};
A.sMethod = function sMethod() {
// ...
};
function B(x, y) {
if(!(this instanceof B)) {
throw new Error('Class constructor B cannot be invoked without \'new\'');
}
A.call(this, x);
A.prototype.method.call(this, y);
}
B.prototype = Object.create(A.prototype);
B.prototype.constructor = B;
B.sMethod = A.sMethod; //static методы тоже наследуются
server{
listen 80;
server_name domain1.ru;
location / {
proxy_pass http://domain1.ru;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $phost;
}
}
db.posts.aggregate([
{
$lookup: {
from: 'user',
localField: 'user_id',
foreignField: '_id',
as: '_user'
}
}
]);
UserSchema.pre('save', function() {
if (!this.apikey) { // проверяем что ещё не задано
this.apikey = SHA512(this.email).toString().to(50);
}
});
Можно упростить жизнь