我不希望我的令牌过期而且永远有效.
var token = jwt.sign({email_id:'123@gmail.com'}, "Stack", {
expiresIn: '24h' // expires in 24 hours
});
Run Code Online (Sandbox Code Playgroud)
在上面的代码我已经给了24小时..我不希望我的令牌过期.该怎么办?
这是我的存储桶策略。我在以下策略中收到错误“策略中的主体无效”错误。为什么会这样?政策有什么问题吗?
{
"Version": "2008-10-17",
"Id": "PolicyForCloudFrontPrivateContent",
"Statement": [
{
"Sid": "1",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity AJDNXHS78E5DD4DF41FD5"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my_bucket/*"
}
]
}
Run Code Online (Sandbox Code Playgroud) 我已经使用下面的代码在 nodejs 中使用简单的图像 npm 模块调整了图像的大小。
var easyimg = require('easyimage');
easyimg.rescrop({
src:'1.jpg', dst:'/var/www/html/bangalore.jpg',
width:100, height:100
}),function(image,err){
// console.log('Resized and cropped: ' + image.width + ' x ' + image.height);
if(image){
console.log(image);
}
else{
console.log(err);
}
}
Run Code Online (Sandbox Code Playgroud)
我有成功的输出。然后我使用带有multer的以下代码将我的图像上传到s3。
var storage = multerS3({
s3: s3,
bucket: 'my_bucket_name',
key: function (req, file, cb) {
console.log(file);
file_name = file.originalname;
var newFileName = Date.now() + "-" + file.originalname;
cb(null, newFileName);
}
});
var upload = multer({storage: storage}).single('profileImage');
upload(req, resq, function (err,res,response) {
console.log(response);
});
Run Code Online (Sandbox Code Playgroud)
现在我的问题是如何在上传到 s3 …
db.audiofiles.aggregate({
$match: {
privacy: { $ne: "same" },
date: { "$eq": "2017/04/25" },
deleted: 0
},
$group: { "_id": "$to_email" }
});
Run Code Online (Sandbox Code Playgroud)
我已经使用$match但仍显示管道错误,如下所示.
assert: command failed: {
"ok" : 0,
"errmsg" : "A pipeline stage specification object must contain exactly one field.",
"code" : 16435
} : aggregate failed
Run Code Online (Sandbox Code Playgroud) 我需要阻止除我自己提供的一两个 IP 之外的所有 IP 地址访问我的网站。我尝试了很多模块,但似乎没有任何效果。
var express = require('express')
var AccessControl = require('express-ip-access-control');
var app = express()
app.get('/', function (req, res) {
res.send('Hello World!')
})
var middleware = AccessControl(options);
app.use(AccessControl(options));
var options = {
mode: 'deny',
denys: [],
allows: ['**8.1**.1.**'],
forceConnectionAddress: false,
log: function(clientIp, access) {
console.log(clientIp + (access ? ' accessed.' : ' denied.'));
},
statusCode: 401,
redirectTo: '',
message: 'Unauthorized'
};
app.listen(3000, function () {
console.log(' app listening on port 3000!')
})
Run Code Online (Sandbox Code Playgroud)
从上面的代码运行和访问我的网站时,我收到的控制台消息为
::ffff:127.0.0.1 accessed.
::ffff:127.0.0.1 accessed.
::ffff:127.0.0.1 …Run Code Online (Sandbox Code Playgroud) var storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, '/tmp/my-uploads')
},
filename: function (req, file, cb) {
cb(null, file.fieldname + '-' + Date.now())
}
})
var upload = multer({ storage: storage })
Run Code Online (Sandbox Code Playgroud)
我需要调整图像大小并将图像大小压缩到最低并上传到目录中。有帮助吗?
正如角度材料选项卡文档中提到的,我的项目中有这个标记:
<mat-tab-group mat-align-tabs="start">
<mat-tab label="First">Content 1</mat-tab>
<mat-tab label="Second">Content 2</mat-tab>
<mat-tab label="Third">Content 3</mat-tab>
</mat-tab-group>
<mat-tab-group mat-align-tabs="center">
<mat-tab label="First">Content 1</mat-tab>
<mat-tab label="Second">Content 2</mat-tab>
<mat-tab label="Third">Content 3</mat-tab>
</mat-tab-group>
<mat-tab-group mat-align-tabs="end">
<mat-tab label="First">Content 1</mat-tab>
<mat-tab label="Second">Content 2</mat-tab>
<mat-tab label="Third">Content 3</mat-tab>
</mat-tab-group>
Run Code Online (Sandbox Code Playgroud)
我的CSS类如下:
.mat-tab-group {
margin-bottom: 48px;
}
Run Code Online (Sandbox Code Playgroud)
但作为输出,我将所有上述选项卡组放置在与下面相同的位置。我希望选项卡组集中。
我的 Angular 版本是 6。有什么帮助吗?
我的 angularCLI 版本如下
Angular CLI: 6.2.9
Node: 8.9.1
OS: win32 x64
Run Code Online (Sandbox Code Playgroud)
此 链接没有关于如何使用该功能的适当文档。任何人都可以帮助解决此包中的任何示例示例吗?文档中提供的 StackBlitz 也不起作用。