From 9045019f97877a8334047a73971c056ff11e174c Mon Sep 17 00:00:00 2001 From: luchenqun Date: Wed, 18 Jan 2017 13:09:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=80=E4=B8=8Bsession?= =?UTF-8?q?=E7=9A=84=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 1 + routes/api.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 3a74bab..80b1694 100644 --- a/app.js +++ b/app.js @@ -26,6 +26,7 @@ app.use(bodyParser.urlencoded({ app.use(cookieParser()); app.use(session({ + rolling: true, resave: false, //添加这行 saveUninitialized: true, //添加这行 secret: 'ILoveYiJia', // 建议使用 128 个字符的随机字符串 diff --git a/routes/api.js b/routes/api.js index c69f700..73f8793 100644 --- a/routes/api.js +++ b/routes/api.js @@ -332,7 +332,7 @@ api.post('/getTitle', function(req, response) { var params = req.body.params; var url = params.url; read(url, function(err, article, meta) { - console.log(article.title); + console.log(article.title || 'Get title failed'); response.json({ title: article.title || '', });