- 安装cheerio
npm install cheerio
Fast, flexible & lean implementation of core jQuery designed specifically for the server.
// method one
var $html = cheerio(res.text); 一个节点对象
var csrf = $html.find('input[name=_csrf]').val();
// method two
let $ = cheerio.load(res.text);
var csrf = $('input[name=_csrf]').val()
"dev-mac": " export NODE_ENV=development&&node bin/www"
"dev-win": " set NODE_ENV=development&&node bin/www”
install cross-env
npm install --save-dev cross-env
用法
{
"scripts": {
"build": "cross-env NODE_ENV=production webpack --config build/webpack.config.js"
}
}