2020年08月19日 18:32 阅读量:1849
node默认的post body参数的大小比较小,如果超过不做特殊处理的话,参数就会传不过去,那么怎样设置post body参数的大小呢?
I don't think this is the express global size limit, but specifically the connect.json middleware limit .
This is 100kb by default when you use express.bodyParser() and don't provide a limit option.
app.js 中设置下面的代码
app.use(bodyParser.json({limit: '2mb'}));
app.use(bodyParser.urlencoded({ limit: '2mb',extended: false, parameterLimit:2000 }));
通过marked配置代码高亮
npm install highlight.js
marked的配置中添加highlight项
var marked = require('marked');
var highlight = require('highlight.js');
marked.setOptions({
renderer: new marked.Renderer(),
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false,
highlight: function (code) {
//自动高亮
return highlight.highlightAuto(code).value;
}
});
页面添加
<link rel="stylesheet" href="/css/googlecode.min.css" />
搜索优化,链接加上nofollow
页面内容链接全部加上 nofollow,在marked.js中修改
var out = '<a href="' + href + '" rel="nofollow"';