'node.js'에 해당되는 글 2건

  1. 2019.08.05 Sequelize와 mysql 연결 에러
  2. 2016.07.24 서버 페이지 여러개 만들기

node.js서 sequelize와 mysql 8.0.17과 연동하는데 에러가 생긴다

mysql의 버그라고 한다

Unhandled rejection SequelizeConnectionError: Client does not support authentication protocol requested by server; consider upgrading MySQL client

> mysql -u root -p

> alter user 'root'@'localhost' identified with mysql_native_password by 'PW';

비밀번호 변경후 정상 동작한다

'node.js' 카테고리의 다른 글

서버 페이지 여러개 만들기  (0) 2016.07.24
Posted by 오아시스베이베
,

다른 페이지로 넘기는거 


1.서버에서는 모든 페이지를 제공해줘야 함

2.url을 parse하여 다른페이지로 넘김


서버


var fs = require('fs');

var http = require('http');

var url = require('url');


http.createServer(function(request,response){

var pathname= url.parse(request.url).pathname;

if(pathname =='/')

{

fs.readFile('htmlpage.html',function(error,data){

response.writeHead(200, {'Content-Type':'text/html'});

response.end(data);

});

}

else if(pathname == '/video')

{

fs.readFile('committee.mp4',function (error,data){

response.writeHead(200, {'Content-Type':'video/mp4'});

response.end(data);

});

}

}).listen(59599,function(){

console.log('server is running');

});


클라이언트


<!DOCTYPE html>

<html>

<head>

<title>Index</title>

</head>

<body>

<h1>Hello Node.js</h1>

<h2>Author.jongsoo-oh</h2>

<hr />

<p>emergency committee</p>

<video src="/video"width="600"height="400"controls autoplay loop></video>

</body>

</html>



'node.js' 카테고리의 다른 글

Sequelize와 mysql 연결 에러  (0) 2019.08.05
Posted by 오아시스베이베
,