nodejs 에서 js 파일 실행하는데 오류가 납니다. 채택완료
초보자나요
4년 전
조회 3,698
</p>
<p>function LivechatServerConfig(){
this.db = new (() => { // db 설정
this.host = '127.0.0.1';
this.port = 3306;
this.user = 'root';
this.password = '1234';
this.dbname = 'test';
this.charset = 'utf8';
})();
this.main = new (() => { // 기본 설정
this.port = 1121;
})();
this.table = new (() => { // 테이블 이름
this.prefix = 'g5_'; // 테이블 접두사
this.member = this.prefix+'member';
this.livechat = this.prefix+'livechat';
this.banlist = this.prefix+'livechat_banlist';
})();
}</p>
<p>module.exports = new LivechatServerConfig();</p>
<p>
오류가 발생하는 소스는 위 소스이고
서버에서 실행시

이런 오류가 나옵니다.

유효성 검사시 이 부분이 오류라는데
어떤 부분을 수정해야할까요?
항상 감사합니다!
댓글을 작성하려면 로그인이 필요합니다.
답변 3개
채택된 답변
+20 포인트
답변에 대한 댓글 2개
�
초보자나요
4년 전
동일하게 구문오류가 나옵니다 ㅠㅠ
s
swallow
4년 전
server.js 에서 LivechatServerConfig() 함수가 어떻게 쓰이는지 알필요가 있군요.
db 나 table 함수를 사용하는부분이 있는지?
db 나 table 함수를 사용하는부분이 있는지?
댓글을 작성하려면 로그인이 필요합니다.
4년 전
</p>
<p>function LivechatServerConfig(){</p>
<p> this.db = new function(){</p>
<p> this.host = '127.0.0.1';
this.port = 3306;
this.user = 'root';
this.password = '1234';
this.dbname = 'test';
this.charset = 'utf8';
}();</p>
<p> this.main = new function(){
this.port = 1121;
}();</p>
<p> this.table = new function(){
this.prefix = 'g5_';
this.member = this.prefix+'member';
this.livechat = this.prefix+'livechat';
this.banlist = this.prefix+'livechat_banlist';
}();
}</p>
<p>module.exports = new LivechatServerConfig();</p>
<p>
이렇게 해보세요
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
4년 전
https://opentutorials.org/course/3347/21185
를 참고해보세요
https://poiemaweb.com/nodejs-mysql
여기를 봐도
접속시에 함수(메소드)내에서 db connection 처리가 좀 다른것 같습니다.
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인