npm install
1. 跨域cors
npm install cors
const cors = require('cors');
app.use(cors());//设置跨域访问
2. 加密crypto
crypto.createHash('sha256').update('password').digest('hex');
3.缓存redis
npm install redis
4 数据库mysql
npm install mysql
var mysql = require('mysql');
var pool = mysql.createPool({
connectionLimit : 10,
host : 'example.org',
user : 'bob',
password : 'secret',
database : 'my_db'
});
pool.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
if (err) throw err;
console.log('The solution is: ', rows[0].solution);
});