수강이 제한됩니다.
다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
하는 것 마다 에러 나는데 버전 때문인가요..
const util = require('util');const crypto = require('crypto');const dontuseme = util.deprecate((x, y) =>{ console.log(x + y);});dontuseme(1,2);이 소스 코드를 쓰면 아래 에러가 나는데 /usr/local/bin/node /Users/usang-in/WebstormProjects/nodejs-crawler/lecture2/util.js internal/process/warning.js:121 throw new ERR_INVALID_ARG_TYPE('warning', ['Error', 'string'], warning); ^ TypeError [ERR_INVALID_ARG_TYPE]: The "warning" argument must be one of type Error or string. Received type undefined at process.emitWarning (internal/process/warning.js:121:11) at deprecated (internal/util.js:61:17) at Object.<anonymous> (/Users/usang-in/WebstormProjects/nodejs-crawler/lecture2/util.js:6:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:643:32) at Function.Module._load (internal/modules/cjs/loader.js:556:12) at Function.Module.runMain (internal/modules/cjs/loader.js:839:10) at internal/main/run_main_module.js:17:11 Process finished with exit code 1 원인이 뭘까요..
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
에러 질문
/usr/local/bin/node /Users/usang-in/WebstormProjects/nodejs-crawler/lecture2/cipher.js internal/crypto/cipher.js:90 this[kHandle].init(cipher, credential, authTagLength); ^ Error: Unknown cipher at Cipher.createCipherBase (internal/crypto/cipher.js:90:19) at Cipher.createCipher (internal/crypto/cipher.js:114:20) at new Cipher (internal/crypto/cipher.js:131:16) at Object.createCipher (crypto.js:111:10) at Object.deprecated (internal/util.js:67:15) at Object.<anonymous> (/Users/usang-in/WebstormProjects/nodejs-crawler/lecture2/cipher.js:3:23) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:643:32) at Function.Module._load (internal/modules/cjs/loader.js:556:12) Process finished with exit code 1 복호화 할때 이런 에러가 뜨는데 왜 그럴까요..
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
sequelize raw query 리턴 질문입니다.
sequelize로 그냥 mysql query를 날려보고있는데 [{"hello",1},{"hello,"2}] //mysql 출력 시 [{"hello":[1,2]}] //sequelize include사용 시 mysql query로 중복되는 부분을 key:[array] 형식으로 sequelize가 include하는 형식으로 표현하고싶은데 하질못하겠습니다. 어떤식으로 sql query를 날리면좋을까요?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
put 에 대해서 질문 드립니다.
put은 에서는 res.redirect('/')가 되지 않더라고요. 구글검색에 303을 넣으라고해서 넣어봤지만 해결되지 않습니다. put에서는 redirect를 사용할 수 없는건가요??
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
관계정의시 관계되어있지 않은 로우조회가 궁금합니다.
만약 제가 좋아요하지않은 게시물만 보고싶다면, 일단 모든게시물을 찾아놓고, 제가 좋아요한 게시물을 다시 찾은다음에 공통사항을 제거하는 방법밖에없나요?? 구글링을 하는데 원하는 답변을 찾을 수가없어서 질문드립니다 ㅠㅠ.
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
질문이 계속생기네요...
sns 만들기 sequelize 관련 질문입니다. 1. User와 Post가 일대다 관계인데 이전 섹션 7에서의 User와 Comment처럼 foreinKey를 이용해서 연결을 위한 컬럼을 만들지 않은 이유가 로그인 상태에서 post하기때문에 req.user를 만들수있고 여기서 req.user.id를 들고올 수 있기 때문인가요? 그런거면 로그인 상태에서는 언제든지 id를 가져올 수 있으니까 굳이 새 컬럼을 만들어줄 필요가 없는건가요? 2. posthashtag에서 post.addHashtags를 하고 workbench를 보니까 createdAt, updatedAt, followingId, followerId 이렇게 4개가 있더라구요. createdAt은 사용자가 지정하지 않으면 db에서 만들어주신다고 하셨었는데 postId와 hashtagId도 그냥 post의 id, hashtag의 id로 만들어주는건가요? (제 기억에는 postId, hashtagId를 만들어준적이 없어서...) 3. 만약에 저것도 알아서 만들어주는거면 follow를 할때 db.User.belongsToMany(db.User, { through: 'Follow', as: 'Followers', foreignKey: 'followingId'});db.User.belongsToMany(db.User, { through: 'Follow', as: 'Followings', foreignKey: 'followerId'}); 만약 위에서 followingId: 1, followerId: 2 가 연결되어 있다고하면 db.User.belongsToMany(db.User, { through: 'Follow'});db.User.belongsToMany(db.User, { through: 'Follow'}); 이렇게 했을 때 userId: 1 과 userId: 2가 연결되는건가요? followerId와 followingId는 그냥 보기 편하게 구분하기 위해서 설정해주는건가요? 4. 직접 model 폴더에 스키마를 만들어주었을 경우에는 id가 붙는데 관계를 맺어주기위해 만든 스키마(follow, like)는 id가 없습니다. 이것도 그냥 시퀄라이즈에서 해주는 작업인가요?
- 해결됨Node.js 교과서 - 기본부터 프로젝트 실습까지
post 부분 질문이요
router.post('/', (req, res, next) => { const post = new Comment({ commenter: req.body.id }) }) 이부분에서 스키마를 ObjectId를 설정했는데 여기서 req.body.id 는 예를들어 email id를 말하는 건가요? req.body.id는 사용자가 작성해서 넣어야 하는 부분인데..email id를 넣으면 새로 생성하는 부분에서 그럼 User부분의 _id를 찾아 ObjectId로 들어간다는건가요? 이부분이 이해가 가질 않네요 .. form 부분에서 무엇을 save를 하는지 이해가 가지 않습니다 ㅜ
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
sequelize 테이블의 primaryKey값 auto_increment질문입니다.
만약 저에게 key값이 1,2,3 인 게시물들이 있을 때 3번을 지우고나서 게시물을 생성하면 key값이 4번인 게시물이 생성됩니다. 만약 제가 그 값이 다시 3부터 되게하려면 어떻게해야하나요??? 실무에서는 이런 key값을 그다지 신경쓰지않나요??
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
제로초님
mongod --auth 를 했는데도 커넥트 했을시 다 보일때는 어떻게 해야 되나요 ㅠㅠ 그리고 비밀번호 설정시 이 에러는 해결 할 방법이 있나요>! ㅠㅠ
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
질문입니다. CLI
commander 사용에 애러가 나는데 도움좀 주실수 있나요?? #!/usr/bin/env node const program = require("commander"); program.version("0.0.1", "-v, --version").usage("[options]"); program .command("template <type>") .usage("--name [name] --path [path]") .description("템플릿을 생성합니다.") .alias("tmpl") .option("-n, --name [name]", "파일명을 입력하세요.", "index") .option("-d, --directory [path]", "생성 경로를 입력하세요", ".") .action((type, options) => { console.log(type, options); }); program.command("*", { noHelp: true }).action(() => { console.log("해당 명령어를 찾을 수 없습니다."); program.help(); }); program.parse(process.argv); C:\Users\Dos\Desktop\lecture\zerocho_node\node_cli\node_modules\commander\index.js:910 this.emit('command:' + this.name(), operands, unknown); ^ TypeError: this.name is not a function at Command._parseCommand (C:\Users\Dos\Desktop\lecture\zerocho_node\node_cli\node_modules\commander\index.js:910:37) at Command._dispatchSubcommand (C:\Users\Dos\Desktop\lecture\zerocho_node\node_cli\node_modules\commander\index.js:860:18) at Command._parseCommand (C:\Users\Dos\Desktop\lecture\zerocho_node\node_cli\node_modules\commander\index.js:877:12) at Command.parse (C:\Users\Dos\Desktop\lecture\zerocho_node\node_cli\node_modules\commander\index.js:712:10) at Object.<anonymous> (C:\Users\Dos\Desktop\lecture\zerocho_node\node_cli\command.js:21:9) at Module._compile (internal/modules/cjs/loader.js:955:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10) at Module.load (internal/modules/cjs/loader.js:811:32) at Function.Module._load (internal/modules/cjs/loader.js:723:14) at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
질문이여
궁금한게 있는데요, 예를들어 학교측에서 api를 제공을하지않거나, api자체가 없다고 하여도, 로그인이 가능하다는데 사실인가요?? 예를들어, 페이지는 다르게 하여도, 로그인정보를 학교측으로 보내서 로그인하고 시간표도 끌고오고 그런다는데 그게 가능한가요?? cors에러 이런게 나지 않나요?? 학교측에서 api를 제공하지 않아 로그인이 못하여도, 개개인 시간표는 크롤링을 통해서 얻을수 있나요?? 크롤링 강의 찍어두신거 들으면 되려나요??
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
ejs req.flash() 질문이요
예를들어 req.flash('joinError', '비밀번호가 일치하지 않습니다.'); 가 있다면 ejs에서 <% if (joinError) { %> <p><%= joinError %> </p> <% } %> 이렇게 했을 때 joinError를 찾을수 없다고 뜹니다. 뭐가 문제인거죠? if문 안에 어떤 변수를 넣어도 변수를 찾을수 없다고 뜹니다.. 변수가 있으면 render가되어야 하는데 ejs에서 변수를 정의할 수 있나요? 이해가 안되네요 ..
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
socket.io-client 질문입니다.
client단의 socket.io설정은 무조건 html파일(혹은 템플릿)안에 선언해야하나요?? public파일에 따로분리할수는없는건가요?
- 해결됨Node.js 교과서 - 기본부터 프로젝트 실습까지
mongoDB local 로그인 질문입니다
mongoDB를 사용해서 local로그인을 구현하려고 하고 있습니다. 1. mongoose로 연결을 시킬때 admin을 꼭 사용해야 하는건가요? 아래를보면 admin부분에 dbName을 넣어도 되는데 admin을 사용하는 이유가 궁금합니다. admin을 사용하고 안하고의 차이점이 무엇인가요? 2. 강의 내용을 토대로 local로그인을 구현중인데 몇시간째 계속 달리지지 않아 제가 방향성이 잘못된것인지 질문드립니다. 제가 user를 findOne을 할 때 .then() 안에서는 user가 null 입니다. 음.. 제가 잘못된 방향으로 구현하고 있는 중인가요? mongoose.connect('mongodb://localhost:27017/admin', { dbName: 'nodeJS', }) -------------- 아래는 ----------------------------- router.post('/join', async (req, res, next) => { const { submitEmail, submitPassword } = req.body; try { const user = User.findOne({ email_id: submitEmail }) console.log('-----------user-------',user) if(user) { req.flash('joinError', '이미 가입된 회원입니다.'); return res.redirect('/login'); } else { console.time('암호화 시간') await bcrypt.hash(password, 12); // 숫자가 높을수록 안정성이 높고 시간이 느려진다. console.timeEnd('암호화 시간') // 시간이 1초정도 걸릴때 까지 숫자를 늘리거나 줄여본다. await new User({ email_id: submitEmail, password: submitPassword }).save().then(()=>{ return res.redirect('/login'); }); // return res.redirect('/login'); } } catch (err) { console.log(err); next(err); } });
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
connect to host 부분 질문이요
compass 에서 connect to host 설정하는 부분이 어디있나요?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
exist 함수 반환이 반대로 되거나 exist함수 호출시 !를 붙혀줘야 하는거 같은데 맞나요 ?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
isLoggedIn 에서 req.isAuthenticated() 질문있습니다.
소셜 로그인 부분에서 req.isAuthenticated() 부분이 인증이 되었음에도 false가 반환됩니다. cookie에서 뭔가 인증을 해줘야하는 건가요? 어떻게 해결해야 하나요?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
sequelize db:create 에러납니다..
sequelize db:create Sequelize CLI [Node: 12.14.0, CLI: 5.5.1, ORM: 5.21.5] Loaded configuration file "config\config.json". Using environment "development". (node:19796) [SEQUELIZE0004] DeprecationWarning: A boolean value was passed to options.operatorsAliases. This is a no-op with v5 and should be removed. ERROR: Access denied for user 'root'@'localhost' (using password: YES) 이런 에러 메세지가 납니다.ㅜㅜ 윈도우 사용중이며 어떻게 해결해야 할까요?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
DB관계설정 질문있습니다.
팔로잉 팔로워 관계가아닌 친구 관계를 설정하려면, 한명의 사람이 여러명의 사람을 친구를(소유?) 가질수있으니 1 대 다 관계인가요? 아니면 팔로잉 팔로워같이 다 대 다 관계인가요?
- 미해결Node.js 교과서 - 기본부터 프로젝트 실습까지
질문입니다
express 객체는 app.use((req, res), 함수), app.use(함수) 이렇게 사용되고 , passport 객체는 passport.use(생성자, 함수) 로 사용되고 생성자의 인자로는 form태그에서 받은 내용이 들어간다고 생각하면 되는건가요? 그리고 passport.use의 함수에 async를 썼는데 이 경우 일반함수를 써도 상관없는 부분이죠?