首页 > 其他 > 详细

Most middleware (like favicon) is no longer bundled with Express

时间:2014-12-09 21:16:20      阅读:1027      评论:0      收藏:0      [点我收藏+]

Error: Most middleware (like favicon) is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.

Solution:

For Express 4 :
// Serve favicon.ico.

$> npm install serve-favicon

Then in your server .js script :
var favicon = require(‘serve-favicon’);
app.use(favicon(options.favicon));

For Express 3 :

This is likely the syntax that gave you the error above

app.use(express.favicon(options.favicon));

Most middleware (like favicon) is no longer bundled with Express

原文:http://www.cnblogs.com/wanghetao/p/4154116.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!