第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

_http_outgoing.js:360 throw new TypeError('The header content contains invalid characters');

_http_outgoing.js:360 throw new TypeError('The header content contains invalid characters');

kathria 2017-07-19 09:36:40
E:\nodetest>node server.js_http_outgoing.js:360? ? throw new TypeError('The header content contains invalid characters');? ? ^TypeError: The header content contains invalid characters? ? at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:360:11)? ? at E:\nodetest\node_modules\express-static\index.js:48:11? ? at FSReqWrap.oncomplete (fs.js:123:15)這個(gè)錯(cuò)誤是什么原因?求大神指教源碼:const express=require('express');const static=require('express-static');const cookieParser=require('cookie-parser');const cookieSession=require('cookie-session');const bodyParser=require('body-parser');const multer=require('multer');const consolidate=require('consolidate');const mysql=require('mysql');//連接池const db=mysql.createPool({host: 'localhost', user: 'root', password: 'yue638', database: 'blog'});var server=express();server.listen(8080);//1.解析cookieserver.use(cookieParser('sdfasl43kjoifguokn4lkhoifo4k3'));//2.使用sessionvar arr=[];for(var i=0;i<100000;i++){? arr.push('keys_'+Math.random());}server.use(cookieSession({name: 'zns_sess_id', keys: arr, maxAge: 20*3600*1000}));//3.post數(shù)據(jù)server.use(bodyParser.urlencoded({extended: false}));server.use(multer({dest: './www/upload'}).any());//4.配置模板引擎//輸出什么東西server.set('view engine', 'html');//模板文件放在哪兒server.set('views', './template');//哪種模板引擎server.engine('html', consolidate.ejs);//接收用戶(hù)請(qǐng)求server.get('/', (req, res)=>{? //查詢(xún)banner的東西? db.query("SELECT * FROM banner_table", (err, data)=>{? ? if(err){? ? ? console.log(err);? ? ? res.status(500).send('database error').end();? ? }else{? ? ? console.log(data);? ? ? res.render('index.ejs', {banners: data});? ? }? });});//4.static數(shù)據(jù)server.use(static('./www'));
查看完整描述

3 回答

?
加咖啡喵

TA貢獻(xiàn)1條經(jīng)驗(yàn) 獲得超0個(gè)贊

請(qǐng)問(wèn)我顯示Cannot GET /index.html是為什么呢? 代碼和你是一樣的

查看完整回答
反對(duì) 回復(fù) 2017-09-24
  • 3 回答
  • 1 關(guān)注
  • 3461 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)