码迷,mamicode.com
首页 > 其他好文 > 详细

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

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

标签:http   io   ar   os   for   on   bs   as   tt   

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   io   ar   os   for   on   bs   as   tt   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!