수강이 제한됩니다.
다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
업로드하는 이미지 파일 명에 공백이 있어도 되나요?
예를들어 파일명이 그리스 사진.png면db에 /img/그리스 사진.png 로 저장이 되는데이래도 클라이언트에서 불러오거나 할 때 상관이 없나요?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
String based operators are now deprecated.
sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modulessequelizelibsequelize.js:242:13npm start하면 위의 메시지가 가장 먼저 출력되는데, 해결방안이 있을까요?sequelize 버전이 오르면서 보안 강화로 String based operators를 앞으로 사용하지 않는다는 것 같은데, 초보라 어떻게 대처해야 하는지 모르겠네요~ 조언 부탁드립니다~
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
Mysql 워크벤치는 그냥 최신버전 받아도 되는거죠?
Mysql 을 5.x.x 버전을 설치하라고 하시길래, 워크벤치도 5.x.x 로 받는게 좋은지 질문드립니다.
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
cookies is not defined 라는 메시지를 받고, 서버가 다운됩니다.
안녕하세요. 좋은 강좌 그동안 잘 듣고있습니다. 이번 강좌의 후반까지 진행중에, 마지막 부분에서 서버가 다운 됩니다. }else if (cookies.name) { res.writeHead(200, {'Content-Type': 'text/html; charset=utf-8' }); res.end(`${cookies.name}님 안녕하세요`);이 부분인데요, cookies is not defined 라는 메시지를 받네요. 실제로 코드 내에서도 cookies를 지정해 주지 않긴 했는데요, 강사님의 원본 코드를 강좌 를 몇번씩 반복하면서 봐도 cookies가 정의된 부분을 찾지 못해서요 ㅇ,.ㅇ;;제가 어딘가에서 빠뜨린 건가요? 이하는 전체 코드입니다. const fs = require('fs');const http = require('http');const url = require('url');const qs = require('querystring');const parseCookies = (cookie = '')=> cookie .split(';') .map( v=> v.split('=')) .map(([k, ...vs])=> [k, vs.join('=')]) .reduce((acc, [k, v])=>{ acc[k.trim()] = decodeURIComponent(v); return acc; }, {});const server = http.createServer( (req, res) =>{ console.log(req.url, parseCookies(req.headers.cookie)); if(req.url.startsWith('/login')){ const {query} = url.parse(req.url) const {name} = qs.parse(query) const expires = new Date(); expires.setMinutes(expires.getMinutes() + 5); res.writeHead(302, {Location: '/', 'Set-Cookie': `name=${encodeURIComponent(name)};Expires=${expires.toGMTString()}; HttpOnly; Path=/`}) res.end(); }else if (cookies.name) { res.writeHead(200, {'Content-Type': 'text/html; charset=utf-8' }); res.end(`${cookies.name}님 안녕하세요`); }else{ fs.readFile('./server4.html', (err, data)=> { res.end(data); }); }}).listen(8080);server.on('listening', ()=>{ console.log('8080 번 포트 서버 대기중입니다.'); })server.on('error', (error)=>{ console.error(error);})
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
혹시 throw error cannot find module 이라는 메시지를 받으면
질문은 아니고요, 간단히 남기고 싶은게 있어서 글 올립니다.강사님과 동일하게 진행했는데, throw error cannot find module 메시지를 받으면서 계속 에러가 나더군요. 제경우, editor를 걍 다시 시작하니 해결했습니다. 코드 자체에 문제가 없어도, 어떤 이유에서인가 발생할 수 있는거 같아요. 혹시, 동일한 문제 겪으신 분들은, 시간낭비하지 말고 프로그램먼저 다시 시작하시기 바랍니다. setInterval(()=>{ console.log('시작'); try { throw new Error('서버를 고장내주마'); } catch (error) { console.error(error); }}, 1000)
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
파일 시스템(fs 모듈)과 콜백에 대해 궁금한게 있습니다.
fs 모듈 강좌중에 궁금한 점이 있어서 질문 올립니다. 일단 강좌중에 나온 코드 먼져 보시죠. 이하는 코드 입니다. const fs = require('fs'); fs.writeFile('./writeme.txt', '글을 써주세요', (err)=> { if(err){ throw err; } fs.readFile('./writeme.txt', (err, data)=>{<p> if (err) {</p><p> throw err;</p><p> }</p><p> console.log(data);</p><p> console.log(data.toString());</p> }) })``` 위와 같은 코드라면 처음에 콜백시에 execution stack이 쌓이고, 실행은 거꾸로 된다고 하셨는데, 그렇다면 위에서도 fs.readFile(~~ 어쩌고 저쩌고 ~~ 콜백)이 fs.writeFile 보다 먼저 실행 되어야 하는거 아닌가요? 그렇다면 결국, 없는 파일을 불러와서 에러가 나와야 하는데... 이 부분이 잘 이해가 안갑니다. ㅜ.ㅜ 마찬가지로, 그다음에 나오는(콜백들을 이용해서 동기 방식처럼 구현하는 부분)에서도, 나중에 호출된 콜백들이 먼저 실행 되어야 하는거 아닌가요? ㅇ,.ㅇ;
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
sns 서버에서 sequelize 질문
동영상처럼 해서 테이블들을 만들었는데, 그럼 계속 nodemon으로 켜져있어서 저장할때마다 테이블이 create된다고 계속뜨는데 이대로 두고 개발을 계속 해도 되는건가요??계속 새로운 테이블로 생기면서 바뀌는게 아닌가 해서요, 그럼 나중에 서버 끄면 db에 저장된 정보들도 날라가진 않나요?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
예제 코드 실행시에 RangeError: Maximum call stack size exceeded 에러가 발생해여 뭔가 잘못 쓴건가여?
function first() { second(); console.log('1 번째'); } function second() { third(); console.log('2 번째'); } function third() { first(); console.log('3 번째'); } // 메서드 실행 first();
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
http.createServer안에서 fs.readFile을 리턴하는 이유가 궁금합니다.
설명 하시는 내용 중에 http.createServer((req, res) => { if (req.method === 'GET') { if (req.url === '/') { return fs.readFile('./restFront.html', (err, data) => { ... 다음과 같이 fs.readFile을 리턴하시는 이유가 단순히 더이상 로직이 아래로 진행되기 위해 리턴을 해 주신건가요? 정확히 왜 리턴을 해 주시는지 몰라서 질문 올려 봅니다.
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
sequelize db:create 했더니 오류가 뜹니다.
오류 내용은 아래와 같습니다.Loaded configuration file "config/config.json".Using environment "development".sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more athttp://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules/sequelize/lib/sequelize.js:242:13ERROR: connect ECONNREFUSED 127.0.0.1:3306ERROR: connect ECONNREFUSED 127.0.0.1:3306무슨일일까요? ㅠㅠ
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
예제 코드를 실행해보려는데, 에러가 터졌습니다.
Unhandled rejection SequelizeDatabaseError: Invalid default value for 'created_at'위에 에러가 나는데, 왜 그런지 모르겠습니다. 소스코드는 변경한 것이 없는데~;;도와주세요~