무료
다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
안녕하세요. 질문이 있습니다. 현재 로그인 페이지 진행 중입니다. Redux Devtools에서 Action,State를 확인하려 했는데 undefined값이 뜹니다.
DB와 연결 문제는 없고, 로그인 실행도 됩니다. 하지만 Redux devtools에 아무런 값이 뜨질 않습니다 ㅠㅠ 다른 코드들과 비교를 계속 해봤는데 코드에서 어떤 문제가 있는지 잘 모르겠습니다. https://github.com/seobi-97/boiler-plate-ko
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
로그인 후에 로그아웃 버튼을 눌렀을 시에 로그인 페이지로 넘어가지 않습니다.
로그인 후에 로그아웃 버튼을 눌렀을 시에 링크 주소가 localhost:3000/? 로 바뀌면서 로그인 페이지로 넘어가지 않네요 ㅠㅠ 아무 에러도 뜨지 않아 확인할 수가 없어요 .. LoginPage 가 잠깐 떴다가 다시 LandingPage 가 뜨네요 혹시 같은 문제를 보신 분 계신가요 ? 어떻게 해결할 지 모르겠습니다 ㅠㅠ
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
user.save is not a function 오류.. 문의드립니다.
User.js index.js Log 실질적으로 DB 연결및 reqbody 값도 정상적으로 들어오는데 User.Save 못찾는 경우는 어떻게 해야할까요?! ㅠㅠ
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
너무 많은 에러들... 갑자기 왜 이럴까요?ㅠㅠ
어느 순간 갑자기 이런 에러들이 많이 뜨는데 구글링 해보아도 재설치 하라는 답변들이 많아서... 혹시 어떻게 해결하면 좋을지 도움 청합니다... ㅠㅠ 깃허브 주소입니다 ㅠㅠ https://github.com/aurpo1/boilerplate 연속으로 계속 이렇게 질문 남기니 부끄럽네요... 이번에도 올리고 제가 해결하면 좋겠다만 ㅠㅠㅠ Compiled with problems:X ERROR in ./node_modules/body-parser/lib/read.js 20:11-26 Module not found: Error: Can't resolve 'zlib' in 'C:\Users\aurpo\boilerplate\client\node_modules\body-parser\lib' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "zlib": require.resolve("browserify-zlib") }' - install 'browserify-zlib' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "zlib": false } ERROR in ./node_modules/body-parser/lib/types/urlencoded.js 217:12-34 Module not found: Error: Can't resolve 'querystring' in 'C:\Users\aurpo\boilerplate\client\node_modules\body-parser\lib\types' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "querystring": require.resolve("querystring-es3") }' - install 'querystring-es3' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "querystring": false } ERROR in ./node_modules/content-disposition/index.js 19:15-39 Module not found: Error: Can't resolve 'path' in 'C:\Users\aurpo\boilerplate\client\node_modules\content-disposition' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }' - install 'path-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "path": false } ERROR in ./node_modules/cookie-signature/index.js 4:13-30 Module not found: Error: Can't resolve 'crypto' in 'C:\Users\aurpo\boilerplate\client\node_modules\cookie-signature' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }' - install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false } ERROR in ./node_modules/destroy/index.js 12:17-41 Module not found: Error: Can't resolve 'fs' in 'C:\Users\aurpo\boilerplate\client\node_modules\destroy' ERROR in ./node_modules/destroy/index.js 14:13-30 Module not found: Error: Can't resolve 'stream' in 'C:\Users\aurpo\boilerplate\client\node_modules\destroy' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }' - install 'stream-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "stream": false } ERROR in ./node_modules/etag/index.js 18:13-30 Module not found: Error: Can't resolve 'crypto' in 'C:\Users\aurpo\boilerplate\client\node_modules\etag' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }' - install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false } ERROR in ./node_modules/etag/index.js 20:12-31 Module not found: Error: Can't resolve 'fs' in 'C:\Users\aurpo\boilerplate\client\node_modules\etag' ERROR in ./node_modules/express/lib/application.js 28:11-26 Module not found: Error: Can't resolve 'http' in 'C:\Users\aurpo\boilerplate\client\node_modules\express\lib' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }' - install 'stream-http' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "http": false } ERROR in ./node_modules/express/lib/application.js 42:14-37 Module not found: Error: Can't resolve 'path' in 'C:\Users\aurpo\boilerplate\client\node_modules\express\lib' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }' - install 'path-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "path": false } ERROR in ./node_modules/express/lib/request.js 18:11-30 Module not found: Error: Can't resolve 'net' in 'C:\Users\aurpo\boilerplate\client\node_modules\express\lib' ERROR in ./node_modules/express/lib/request.js 22:11-26 Module not found: Error: Can't resolve 'http' in 'C:\Users\aurpo\boilerplate\client\node_modules\express\lib' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }' - install 'stream-http' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "http": false } ERROR in ./node_modules/express/lib/response.js 23:11-26 Module not found: Error: Can't resolve 'http' in 'C:\Users\aurpo\boilerplate\client\node_modules\express\lib' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }' - install 'stream-http' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "http": false } ERROR in ./node_modules/express/lib/response.js 29:11-26 Module not found: Error: Can't resolve 'path' in 'C:\Users\aurpo\boilerplate\client\node_modules\express\lib' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }' - install 'path-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "path": false } ERROR in ./node_modules/express/lib/utils.js 31:18-40 Module not found: Error: Can't resolve 'querystring' in 'C:\Users\aurpo\boilerplate\client\node_modules\express\lib' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "querystring": require.resolve("querystring-es3") }' - install 'querystring-es3' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "querystring": false } ERROR in ./node_modules/express/lib/view.js 16:11-26 Module not found: Error: Can't resolve 'path' in 'C:\Users\aurpo\boilerplate\client\node_modules\express\lib' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }' - install 'path-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "path": false } ERROR in ./node_modules/express/lib/view.js 18:9-22 Module not found: Error: Can't resolve 'fs' in 'C:\Users\aurpo\boilerplate\client\node_modules\express\lib' ERROR in ./node_modules/mime-types/index.js 15:14-37 Module not found: Error: Can't resolve 'path' in 'C:\Users\aurpo\boilerplate\client\node_modules\mime-types' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }' - install 'path-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "path": false } ERROR in ./node_modules/mime/mime.js 1:11-26 Module not found: Error: Can't resolve 'path' in 'C:\Users\aurpo\boilerplate\client\node_modules\mime' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }' - install 'path-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "path": false } ERROR in ./node_modules/mime/mime.js 3:9-22 Module not found: Error: Can't resolve 'fs' in 'C:\Users\aurpo\boilerplate\client\node_modules\mime' ERROR in ./node_modules/parseurl/index.js 13:10-24 Module not found: Error: Can't resolve 'url' in 'C:\Users\aurpo\boilerplate\client\node_modules\parseurl' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "url": require.resolve("url/") }' - install 'url' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "url": false } ERROR in ./node_modules/send/index.js 29:9-22 Module not found: Error: Can't resolve 'fs' in 'C:\Users\aurpo\boilerplate\client\node_modules\send' ERROR in ./node_modules/send/index.js 39:11-26 Module not found: Error: Can't resolve 'path' in 'C:\Users\aurpo\boilerplate\client\node_modules\send' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }' - install 'path-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "path": false } ERROR in ./node_modules/send/index.js 43:13-30 Module not found: Error: Can't resolve 'stream' in 'C:\Users\aurpo\boilerplate\client\node_modules\send' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }' - install 'stream-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "stream": false } ERROR in ./node_modules/send/index.js 45:11-26 Module not found: Error: Can't resolve 'util' in 'C:\Users\aurpo\boilerplate\client\node_modules\send' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }' - install 'util' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "util": false } ERROR in ./node_modules/serve-static/index.js 20:14-37 Module not found: Error: Can't resolve 'path' in 'C:\Users\aurpo\boilerplate\client\node_modules\serve-static' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }' - install 'path-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "path": false } ERROR in ./node_modules/serve-static/index.js 24:10-24 Module not found: Error: Can't resolve 'url' in 'C:\Users\aurpo\boilerplate\client\node_modules\serve-static' BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it. If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "url": require.resolve("url/") }' - install 'url' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "url": false }
- 해결됨따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
postman 관련 에러해결방법
저 같은 경우는 별다른 이상이 없는데 axios통신에러가 났었습니다. 저는 vscode에서 작업 중인데 우선 ctrl+c를 해서 서버를 끈 다음 저장을 다시 해주세요. 혹은 vscode 나갔다가 오셔야합니다. 그리고 npm run start를 했을 때 바로 동작이 되는 경우가 있습니다. 이래도 안되면 syntax에러일 확률이 높습니다. json타입으로 보낼 때 user.js에도 데이터 타입 다시확인 하시고요. (vscode의 마켓플레이스에 오탈자나 들여쓰기를 해결해주는 것들이 있습니다.) 콘솔로 DB연결과 서버연결이 되는지 순차적으로 확인 하시면서 따라가면 될겁니다 +axios 부분 post할 때 경로 확인하세요. const express = require('express') const app = express() const port = 5000 const bodyParser = require('body-parser'); const { User} = require("./models/User"); //application/x-www-form-urlencoded app.use(bodyParser.urlencoded({ extended: true})); //application/json app.use(bodyParser.json()); //mongodb 연결 const mongoose = require('mongoose') mongoose.connect('mongodb+srv://id:password@boilerplate.apclh.mongodb.net/myFirstDatabase?retryWrites=true&w=majority') .then(() => console.log('MongoDB Connected')) .catch(err => console.log('error')) app.get('/', (req,res) => res.send('Hello World')) app.post('/register',(req,res) => { //회원가입 할때 필요한 정보들을 client에서 가져오면 //그것들을 데이터 베이스에 넣어준다. const user = new User(req.body) user.save((err, userInfo) => { if(err) return res.json({ success:false, err}) console.log(userInfo.body); return res.status(200).json({ success: true }) }) }) app.listen(port, () => console.log('Example app listening on port ${port}!'))
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
failed to sign up 해결이 안됩니다 ㅠㅠ
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'push') 페이지 콘솔창에서 확인해보니 이런 오류가 나있고 계속 failed to sign up이 뜹니다 다른분들의 답변에서도 해결책을 찾을 수 없어 도움 청합니다 ... 포스트맨 사용하니 register success가 나오는거 같은데,, 깃허브 주소 첨부합니다ㅠ https://github.com/aurpo1/boilerplate
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
토큰 만료기간 설정
이 강의에선 토큰 만료에 대해선 다루지 않은게 맞지요?? 그렇다면 강사님의 코스 중에 이걸 다루는 강의가 있을까요??
- 해결됨따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
로그아웃 문제 isAuth: fasle
안녕하세요 강의 정말 잘 듣고 있습니다 nodejs 마지막 로그아웃만 하면 되는데 도저히 오류를 못 찾고 있습니다 ㅠㅠ 도와주시면 정말 감사하겠습니다 포스트맨에서 로그아웃 할 시에 아래 오류만 뜹니다 { "isAuth": false, "error": true } 똑같은 오류에 대한 다른 분들의 질문 답변을 봐도 해결이 안되고 코드를 몇번이나 봤는데도 어디가 잘못 됐는지 모르겠네요 ㅠㅠ 깃허브 주소 남깁니다 감사합니다 https://github.com/aurpo1/boilerplate.git
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
MongoDB에서..
Cluster Tier에서 싱가포르를 선택을 했는데 M0이 전혀 보이지 않습니다. ㅠㅠ 어떻게 해야 할까요?
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
웹펙5
백엔드를 실행시키고 클라이언트 부분은 npm run start 로 실행시키니 로컬호스트가 뜨고 에러를 보여줍니다. 에러를 찾아보니 웹팩5에서는 자동으로 더이상 뭔가를 해주지 않는다고 말하는거 같은데 이를 해결하려면 fallback을 뭐 하라는것 같은데 이거를 어떻게 해야하는지 모르겠습니다.
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
마지막 강의에서 만난 오류 두가지 해결과정
여태껏 다른 분들이 달아주신 댓글을 종합해서 정리해봤습니다 # 1. 첫번째 오류 - v6 오류 Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it. 이 오류는 v6에서 element 내부에 Auth 지원이 안되어서 생기는 오류 같습니다 ## 1-1. 해결방법 ### 1-1-1. App.js element 수정하기 <BrowserRouter> <Routes> <Route exact path="/" element={Auth(LandingPage, null)} /> <Route exact path="/login" element={Auth(LoginPage, false)} /> <Route exact path="/register" element={Auth(RegisterPage, false)} /> </Routes> </BrowserRouter> 여기서 Auth를 모두 지우고 컴포넌트를 넣으세요 <BrowserRouter> <Routes> <Route exact path="/" element={<LandingPage />} /> <Route exact path="/login" element={<LoginPage />} /> <Route exact path="/register" element={<RegisterPage />} /> </Routes> </BrowserRouter> (이렇게) ### 1-1-2. 각 컴포넌트 export 위치에 Auth를 감싸기 export default LoginPage; export default LandingPage; export default RegisterPage; 지금 LoginPage, LandingPage, RegisterPage의 export가 그냥 이렇게 되어있을 겁니다 이자리에서 Auth로 감싸줄 겁니다 export default Auth(LoginPage, null); export default Auth(LandingPage, false); export default Auth(RegisterPage, false); 이렇게 변경하시면 됩니다 그리고 강의 중에 작성하는 모든 props.history는 import { useNavigate } from 'react-router-dom' let navigate = useNavigate() navigate('/login') navigate('/') 로 작성하시면 됩니다 # 2. 두번째 오류 - auth.js의 액션 이름 괄호 놓침 Uncaught TypeError: (0 , _actions_user_action__WEBPACK_IMPORTED_MODULE_2__.auth)(...).then is not a function 이런 오류가 뜨면서 백지가 나타났는데 오류 의미를 몰라서 한참 찾았습니다 ## 2-1. 해결방법 React.useEffect(() => { dispatch(auth().then(response => { console.log(response) })) }, []) 이렇게 되어있었는데, (auth().then()) 가 아니라 (auth()).then() 입니다 React.useEffect(() => { dispatch(auth()).then(response => { console.log(response) }) }, []) 찾기 힘든 오타라 저는 한참 찾았어요.... 조심하시길.... # 3. 세번째 오류 - 이유를 알 수 없는 504 서버에러 이건 그냥 빡쳐서 자고 다음날 하니까 해결 됐습니다 정 안되면 다음날 해보세요
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
결과가 HTML로 뜨고 user is not defined 라고 나타나시는 분들
강사님이 댓글에 답변을 달아주셨지만 그걸 해석하기가 너무 힘들어서... 저처럼 답변 한참 해석하시지 말라고 정리해둡니다 user가 없다고 뜨는 이유는 진짜 user를 못찾아서 입니다. (아마 vscode에서 못찾겠다고 이미 밑줄을 그었을거에요) user는 User.findOne 에서 실행되는 콜백함수의 인자인 user입니다. 그래서 반드시 User.findOne 스코프 안에서만 찾을 수 있습니다. 이 user는 언제 생기냐면, User.findOne로 해당 이메일을 가진 사용자가 있을 때 생깁니다. 이걸 받아와서 비밀번호 비교든, 토큰 생성이든 써먹으려면 이 안에 있어야겠죠. 이 오류가 뜬 분들은 아래처럼 구조가 되어있을거에요 User.findOne({ email: req.body.email }, (err, user) => { // 이메일로 찾기 }); user.comparePassword(req.body.password, (err, isMatch) => { // 이메일로 찾은 유저정보를 받아와서 비밀번호 비교 }); user.generateToken((err, user) => { // 이메일로 찾은 유저정보를 받아와서 토큰 생성 }); 이걸 아래처럼 바꿔주면 됩니다. 감싸주면 돼요 User.findOne({ email: req.body.email }, (err, user) => { // 이메일로 찾기 user.comparePassword(req.body.password, (err, isMatch) => { // 이메일로 찾은 유저정보를 받아와서 비밀번호 비교 }); user.generateToken((err, user) => { // 이메일로 찾은 유저정보를 받아와서 토큰 생성 }); }); 왜 저건 대문자 User이고 이건 소문자 user인거지? 생각했었는데 둘은 완전히 다른거에요..... 한시간동안 찾았네요.... 저처럼 고생하지 마시길....
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
TypeError 관련 질문드립니다.
안녕하세요 강사님 8분 53초까지 코드 잘 따라 적었는데 npm run start 이후에 TypeError가 나오네요. overstackflow에서는 문법 문제라고 하는데 어디가 잘못된지 모르겠습니다. 혹시 한 번 확인해 주시면 감사하겠습니다! 양질의 무료강의에 대해서 다시 한번 감사의 말씀드립니다 좋은하루되세요!!
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
데이터베이스 못찾으시는 분들
UI가 업데이트된건지 강사님과 화면이 다르네요 아래 화면에서 프로젝트 이름 (저는 boilerplate) 누르면 나오는 화면에서 collections 누르시면 나옵니다 1. 프로젝트 이름 클릭 2. collections클릭
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
토큰 복호화 질문
지금까지 jwt는 복호화가 안되고 암호화만 되는걸로 강의 들었었거든요. 이번강의에서는 서버에서 복호화해서 인증을 하더라구요. jwt도 복호화 가능한거죠??
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
안녕하세요, 질문 몇 가지 입니다.
안녕하세요, 먼저 좋은 강의 감사드립니다. 강의 공부 이후 몇가지 질문이 있어 글 남깁니다 ! 1. 아래 코드에서 bcrypt.hash(user.password, salt, function (err, hash) { //암호화 할 데이터, 암호 해시에 사용할 솔트.숫자로 지정되면 지정된 라운드 수로 솔트가 생성되어 사용됨. //cb : 데이터가 암호화 되면 호출 발생(오류,암호화된 양식을 제공하는 콜백의 매개변수.) if (err) return next(err); user.password = hash; next(); }); hash()의 콜백은 데이터가 암호화 되면 발생한다고 하였는데, 그럼 hash의 파라미터 두개가 들어온 시점에서 이미 암호화가 된것인가요? user.password = hash를 해주는 것이 암호화를 해주는 것 아닌가요? 2. userSchema.methods.generateToken = function (cb) { var user = this; //jsonwebtoken을 이용해서 토큰생성하기. var token = jwt.sign(user._id.toHexString(), "secretToken"); user.token = token; user.save(function (err, user) { if (err) cb(err); cb(null, user); }); }; sign()에서 user.id를 toHexString()으로 해서 넣어줬는데, 그렇다면 만약 제가 db에 따로 id항목을 만들어서 1~관리한다고 치면 user._id가 아닌 user.id를 사용해도 괜찮은것인가요? 또한 위에서 save를 쓰는데 우리는 위에서 pre("save"를 만들었습니다. 그럼, 이 코드에서도 위에서 작성한 pre가 작동한 이후에 비밀번호가 바뀌는 경우가 아니기때문에 그냥 next()되는 것인가요? 3. 서버측 auth.js에서, let token = req.cookies.x_auth; 이 코드는 cookies가 따로 선언된곳이나, 들어오는 request에도 쿠키가 있는지 잘 모르겠습니다. 어떻게 사용할수있는건가요 ?? 4. 서버측 user.js의 pre ("save, 중 //isModified("문서") : 가 수정된 경우 true를 반환하고, 그렇지 않으면 false를 반환한다. if (user.isModified("password")) { //gensalt : generate Salt for my password which need to encrypted bcrypt.genSalt(saltRounds, function (err, salt) { 제가 이해한 바로는, 이 isModified는 password가 수정된 경우 true를 반환하는 함수인데, 우리는 회원가입 할 때 save 직전에 이 함수가 실행됩니다. 이 때 회원가입에서 사용되는 데이터는 클라이언트 측에서 보내온 데이터이구요. 그렇다면 password의 변경점이 없었다고 생각하는데 왜 true가 반환되어 실행되는 것인가요? genSalt도 아래에 있기에 입력숫자 -> salt변경도 아닌 것 같고, 혹시 db스키마를 만들면 기본값으로 들어있는 값이 있는것인가요 ? 5. loginPage에 onSubmit이 action Creater dispatch( loginUser(body) )에서 loginUser를 action 이 맞나요 ? 6. 혹시 //applyMiddleware : 미들웨어를 적용하는 것. //promiseMiddleware와 ReduxThunk를 적용하고, createStore를 통해 store를 만들어 준다. const createStoreWithMiddleware = applyMiddleware( promiseMiddleware, ReduxThunk )(createStore); 와 같이 마지막에 (괄호)를 사용하는 문법은 어떤 문법일까요 ?(뭐라고 검색해서 찾아봐야할까요??) 저 코드를 arrow나 function 형태로 정리하면 어떤 식인가요? (아래 질문에 첨부한 코드에서 파라미터를 넣는 형식이 이해가 가지 않아서 질문합니다.) 7. 전체적인 흐름을 다시한번 파악하면서 공부중인데, redux의 type에 관해서 잘 이해가 가지 않습니다. types.js에서는 어째서 "login_user"와 같이 소문자를 넣어줬는지 (이 부분을 찾아보니 redux의 type권장 ??이라고 하는데 영어가 좀 부족해서 공식문서를 제대로 읽질 못했습니다 ㅠㅠ) _reducers 폴더에 user_reducer.js에 해당하는 내용이 어떤 파일에서 사용이 되었는지 (제가 이해하기로는 client/index.js에서 import Reducer from "./_reducers"; <Provider store={createStoreWithMiddleware( Reducer, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() )} > 에서 Reducer에서 자동으로 _reducers의 index.js를 파악하고, index.js 안에서 combine된 항목들 중 user reducer를 store로 올려 state를 관리하게 한다. 혹시 이게 맞을까요 ? ) 강의를 끝까지 다 들어보고 한번에 질문을 올려 질문이 너무 많은 것 같아 죄송합니다. 좋은 강의 찍어주셔서 감사합니다. 앞으로 로드맵 열심히 따라 가보도록 하겠습니다 !
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
아이피 오류 뜨시는 분들
Network Access 에 들어가서 IP 주소 추가 버튼을 누르시면 모달창이 뜨잖아요? IP를 직접 입력하지 마시고 상단에 있는 현재 아이피 주소 추가 버튼을 누르세요 왜인지는 모르겠지만 제 네트워크 주소와는 전혀 다른 IP가 추가됐는데 오류가 해결됐습니다
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
postman 오류입니다 도와주세요 ㅠㅠ
응답 값이 이렇게 나오는데 err 메세지에 아무것도 적혀있지 않아서 모르겠습니다 알려주세요 ㅠㅠ 다음은 제 코드입니다 User.js const mongoose = require("mongoose"); const userSchema = mongoose.Schema({ name: { type: String, maxlength: 50, }, email: { type: String, trim: true, unique: 1, }, password: { type: String, minlength: 5, }, lastname: { type: String, maxlength: 50, }, role: { type: Number, default: 0, }, image: String, token: { type: String, }, tokenExp: { type: Number, }, }); const User = mongoose.model("User", userSchema); module.exports = { User }; index.js const express = require("express"); //express module 호출 const app = express(); const port = 5000; const { User } = require("./models/User"); //application/x-www/form-urlencoded app.use(express.urlencoded({ extended: true })); //express 4.x 버전부터는 express에 bodyParser가 내장됩니다. //application/json app.use(express.json()); const mongoose = require("mongoose"); mongoose .connect( "mongodb+srv://do:1234@cluster0.e91ss.mongodb.net/myFirstDatabase?retryWrites=true&w=majority" ) .then(() => console.log("MongoDB Connected...")) .catch((e) => console.log("MongoDB error: ", e)); app.get("/", (req, res) => res.send("Hello World!")); app.post("/register", (req, res) => { //회원 가입 할때 필요한 정보들을 client에서 가져오면 //그것들을 데이터 베이스에 넣어준다. const user = new User(req.body); user.save((err, userInfo) => { if (err) return res.json({ success: false, err }); return res.status(200).json({ success: true, }); }); }); app.listen(port, () => console.log(`Example app listening on port ${port}!`));
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
로그아웃 안되시는 분들 참고해주세요!
//logout 때 postman response 결과 { isAuth: false, error: true } 코드는 문제 없는데 이렇게 나오시는 분들 포스트맨에서 get 요청할 때 포스트맨에 send 아래에 cookies 들어가서 x_auth 쿠키 있는지 확인해주세요! 가장 기본적인 걸 못보고 코드만 고치려 했습니다... 며칠 걸쳐서 듣게 되었는데 포스트맨에서 전날에 로그인했다가 끄고 새로 다음 날에 로그아웃 하려하다보니 포스트맨에서 쿠키가 없어서 그런 것이었더군요,,,ㅠㅠ
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
bcrypt.compare 질문
bcrypt.compare에 plainPassword는 login시 password값이 암호화해서 들어가고 this.password는 데이터베이스에 암호화되어있는 패스워드이고 두개를 비교해서 같으면 참 다르면 거짓인가요?? 이해한게 맞는건지 ,, 또 암호화되어있는 this.password는 console.log찍으면 undefined나오는게 맞는건가요? this password는 ismatch 찍은 위치에서 찍어봤어요