Finally back to Beijing, just the first day to fill in a variety of forms, but also received the public Security Bureau’s phone, very nervous. The isolation environment of the hotel is ok, and the three meals a day are quite sumptuous, but the space is too small for activities.
The code you want to leave behind
1. Previously, some data files that do not change often were introduced by using script label, but the files of this project were changed to private read and write, so this method cannot be used, so we need to call the interface of OSS in the Node layer to get data from the bucket, and use AWS – SDK
const AWS = require('aws-sdk')
const BaseService = require('./base') class getFileService extends BaseService { constructor(args) { super(args) const { config, ctx } = this this.s3 = new AWS.S3({ ... config.awsConfig, logger: {log(str) {
ctx.logger.info(str)
}
}
})
}
async index(params) {
const { ctx, logger } = this
return new Promise((resolve, reject) => {
this.s3.getObject(params, (err, data) => {
if (err) {
logger.error(
"xxxxxx"
)
return reject(
new Error({
status: 'DOWNLOAD_FILE_ERROR',
code: 500,
message: err
})
)
} else {
let fileContext = data.Body.toString()
fileContext = fileContext.replace(/[\r\n]/g, ' ')
return resolve(JSON.parse(fileContext))
}
})
})
}
}
module.exports = getFileService
Copy the code
In the pit of
The project was released later because this project is an Intranet project, while OSS is an external one, so it cannot be accessed unless you apply for permission. Later, we communicated with o&M that OSS has a domain name corresponding to the Intranet. After the change, configure the corresponding host on the pre-deployed machine
learning
- Read the soft peak network log to collect their own absolutely better links
- The principle and implementation of RSA
- User-agent When the browser sends a request to the server, it carries a user-Agent field, which indicates some software information of the client. Chrome intends to freeze this field, and this article covers the details of the new scheme.
- Progressive -image-element An HTML custom element that can lazily load web images. The code for this element is very simple and can be used as an example for learning how to write custom elements.
- Rome, the new work of the founders of Babel, a new JavaScript tool library, includes all the main JS tools in one repository. You don’t need Webpack, ESLint, Prettier, Babel, it provides them all. The core idea is to unify all AST (abstract syntax tree) based functionality, rather than each tool doing AST parsing itself.