무료
다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
import Reducer from './_reducers'; 에서 Reducer가 뭔가요?
_reducers/index.js 의 파일을 보면 Reducer라고 명시된 변수가 없고 rootReducer라는 변수만 있는 것 같은데 이 상태에서 Reducer를 import하는 건 어떤 값을 불러오는 건지 모르겠습니다
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
export 관련 문의
안녕하세요 선생님! 강의 완강하고 재수강하면서 다시 복습 중인데 질문이 있습니다. module.exports로 export 하는 것과 page에서 하듯이 export default 이런식으로 하는 것의 차이가 무엇인지요?
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
withRouter 기능이 무엇인가요?
안녕하세요 좋은 강의 잘 듣고 있습니다. 다름이 아니라, 로그인을 성공적으로 진행한 후 '/' 라우터로 (home으로) 리다이렉트할 때 Unhandled Rejection (TypeError): Cannot read property 'push' of undefined 위 에러가 떠서 찾아보니 withRouter로 감싸주어 처리해주면 위 에러가 사라지더라구요. react-router-dom의 withRouter를 찾아보니 컴포넌트에서 다른 컴포넌트를 사용할 때 쓴다고 하던데, 그럼 export default RegisterPage랑 export defalut withRouter(RegisterPage)랑 큰 차이가 없지 않나 싶은데, 에러가 사라지는게 신기합니다. withRouter로 발생하는 차이가 따로 있을까요? 감사합니다.
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
index.html , index.js 가 어떻게 연결되어 있나요?
각각의 파일을 보는데, index.html 에서 src/index.js를 링크하는 내용이 없는 것 같습니다. 그러면 index.js에서 getElementById를 써서 root태그를 잡는 게 안되지 않나요?
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
08:02 SSH 키 접근이 안되면
window기준으로 git bash로 여시고 cat ~/.ssh/id_rsa.pub 해보시면 나옵니다!
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
npm run start 실행시 에러가 뜹니다
package.json 파일입니다! { "name": "nodejs_study", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "start": "node index.js", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "jung", "license": "ISC", "dependencies": { "express": "^4.17.1" } } 에러 메세지입니다. 이렇게 에러가 떠서 실행이 안되는데, 같은 문제를 겪고 계신 분들이 계신 것 같아서 확인 부탁드립니다. 좋은 강의 감사합니다 :)
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
AuthenticationCheck의 props
좋은 강의 무료로 제공해주셔서 감사합니다!!! auth.js에서 AuthenticationCheck(props) function 안에서 props.history.push를 쓰시는데 props가 어디에서 넘어왔다고 이해하면 될까요? 그리고 각 케이스마다 history.push를 통해 다른 페이지로 이동시켜주는데 return <SpecificComponent />의 역할이 잘 이해가 안갑니다. HOC 문법인지 다른 의도가 있는건지 궁금합니다!
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
{ User } 에 중괄호를 넣는 것의 의미
User 자바스크립트 파일을 가져올 때 다음과 같이 중괄호를 넣어서 하는데 그것의 의미는 무엇인가요? const { User } = require("./models/User");
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
몽고 cluster 못찾으시는 분들
강의에는 안나오지만 일단 프로젝트를 하나 만들고 Build a Database 누르면 0:56과 같은화면 나옵니다!
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
포스트맨에서 Success 나오는데 서버로가면 값이 안나와요ㅠ
포스트맨에서 값을 전송했는데 서버에가면 값들을 제대로 못받아오는데 무엇이 잘못되었을까요..ㅠ //index.js const express = require('express') const app = express() const port = 5000 const bodyParser = require('body-parser'); const config = require('./config/key'); const { User } = require("./models/User"); //application/x-www-form-urlencoded app.use(express.urlencoded({extended: true})); //application/json app.use(express.json()); const mongoose = require('mongoose') mongoose.connect(config.mongoURI,{ useNewUrlParser: true,useUnifiedTopology:true,useCreateIndex:true,useFindAndModify:false }).then(() =>console.log('MongoDB Connected...')) .catch(err =>console.log(err)) app.get('/', (req, res) => res.send('Hello SOSO!!!!!!!!!!!!!!!~~')) 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 at http://localhost:${port}!`)) //User.js const mongoose = require('mongoose'); const bcrypt = require('bcrypt'); const saltRounds = 10; 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 } }) userSchema.pre('save',function( next ){ var user = this; if(user.isModified('password')){ //비밀번호 암호화시킨다. bcrypt.genSalt(saltRounds, function(err, salt) { if(err) return next(err); bcrypt.hash(user.password, salt, function(err, hash){ if(err) return next(err); user.password = hash; next(); }) }) } else{ next(); } }) const User = mongoose.model('User',userSchema) module.exports = { User } req.body 찍어보면 빈객체로 나와요
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
안녕하세요. 프론트에서 로그인이 안됩니다.
제 생각은 proxy setup이 조금 이상한거 같은데 혹시 아시는 분 계실까요?git: https://github.com/alsemffp82/boiler-plate/tree/master
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
POSTMAN 오류입니다 ㅠㅠ
계속 이렇게 뜨네요 ㅠㅠ 무슨 문제일까요...? https://github.com/maruihitoha/boilerPlate_tutorial 입니다..
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
postman 오류
강의와 모든부분 동일하게 작성했고 postman 에서 send 클릭시에 계속해서 오류가 발생하는데 어떤부분이 문제인지 모르겠습니다 ㅠㅠ GITHUB 주소 첨부합니다 ( React-Node ) 폴더 https://github.com/OHYUNBEOM index.js User.js postman 오류 visual studio code 오류
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
postman 오류(Cannot POST /register)
postman에서 send를 누루면 Cannot POST /register << 이런 에러가 나와요 const express = require('express') //express module을 가져와라 const app = express() //express() function 을 이용해서 express app 을 만듬 const port = 5100 const mongoose = require('mongoose') const bodyParser = require('body-parser'); const {User} = require("./models/User"); app.use(bodyParser.urlencoded({extended:true})); app.use(bodyParser.json()); mongoose.connect('mongodb+srv://000000@0000000.7lopm.mongodb.net/myFirstDatabase?retryWrites=true&w=majority', { useNewUrlParser : true, useUnifiedTopology : true, useCreateIndex : true, useFindAndModify : false }).then(()=> console.log('MongoDB Connected..')).catch(err => console.log(err)) app.get('/', (req, res) => { res.send('Hello World!') })app.post('/register', (req, res) => { 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 }) }) })
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
좋은 자료로 잊고가는 기초들도 다시 공부할 수 있어 정말 감사합니다.
혹시나 가능 하시다면, Typescript로 리액트와 express 강의 같은 내용을 해주실 수 없으실까요? 유료라도 결제해서 꼭 보고 싶습니다.
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
postman에서 logout success는 나오는데 DB에서 token은 안 지워져요
postman에서 log out을 하면 success message는 뜨는데 DB의 token은 안지워지는데 따라히면서 같은 오류를 겪으신 분 혹시 계신가요?
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
db connectio 에러
DB 연결에서 계속 오류가 나요 에러 메시지 보고 cmd 창에서 ip 보고 mongoDB network access 에서 ip 수정하고 다시 이전꺼랑 해서 새로 추가했는데 동일하게 오류가 나와요 확인 부탁드립니다 ㅜㅜ PS D:\nodeJs\models> npm run start > nodejs@1.0.0 start D:\nodeJs > node index.js Example app listening at http://localhost:5100 MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/ at NativeConnection.Connection.openUri (D:\nodeJs\node_modules\mongoose\lib\connection.js:846:32) at D:\nodeJs\node_modules\mongoose\lib\index.js:351:10 at D:\nodeJs\node_modules\mongoose\lib\helpers\promiseOrCallback.js:32:5 at new Promise (<anonymous>) at promiseOrCallback (D:\nodeJs\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:10) at Mongoose._promiseOrCallback (D:\nodeJs\node_modules\mongoose\lib\index.js:1149:10) at Mongoose.connect (D:\nodeJs\node_modules\mongoose\lib\index.js:350:20) at Object.<anonymous> (D:\nodeJs\index.js:14:10) at Module._compile (internal/modules/cjs/loader.js:1251:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1272:10) at Module.load (internal/modules/cjs/loader.js:1100:32) at Function.Module._load (internal/modules/cjs/loader.js:962:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) at internal/main/run_main_module.js:17:47 { reason: TopologyDescription { type: 'ReplicaSetNoPrimary', setName: null, maxSetVersion: null, maxElectionId: null, servers: Map(3) { 'wwwpyk-shard-00-01.7lopm.mongodb.net:27017' => [ServerDescription], 'wwwpyk-shard-00-02.7lopm.mongodb.net:27017' => [ServerDescription], 'wwwpyk-shard-00-00.7lopm.mongodb.net:27017' => [ServerDescription] }, stale: false, compatible: true, compatibilityError: null, logicalSessionTimeoutMinutes: null, heartbeatFrequencyMS: 10000, localThresholdMS: 15, commonWireVersion: null } }
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
heroku 배포에 대하여
안녕하세요. 헤로쿠 배포해서 url 까지 받았는데요 url을 열면 localhost:5000번 즉, client 화면이 안나오고 server쪽에서 열리더라고요... 어떻게 해야 할까요??
- 미해결따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
heroku 배포에 관하여
좋은 강의 감사합니다. 강의대로 모든 준비를 마치고 heroku에 배포한 결과 Client는 정상적으로 동작하는데 서버가 정상적으로 동작하지 않는 것 같습니다. 로그인 또는 회원가입을 시도할때 다음과 같은 에러가 발생합니다. 일단 package.json 파일은 다음과 같이 수정했는데 어느 부분을 수정해야 할지 모르겠습니다. 배포를 해야 다음 강의를 진행할텐데 여기서 멈춰있습니다. 바쁘시겠지만 도움 부탁드립니다. 감사합니다. 수정한 부분은 다음과 같습니다. "scripts": { "start": "concurrently \"npm run server\" \"npm run client\"", "server": "node server/index.js", "client": "cd client && npm start", "test": "echo \"Error: no test specified\" && exit 1", "heroku-postbuild": "cd client && npm install && npm run build" }, const port = process.env.PORT || 5000; app.listen(port, () => console.log(`Example app listening on port ${port}!`));
- 해결됨따라하며 배우는 노드, 리액트 시리즈 - 기본 강의
TypeError: user.comparePassword is not a function 라고 에러메시지가 뜹니다..
현재 토큰생성 with jsonwebtoken 들으면서 진행중에 있는데요. 여기서 TypeError: user.comparePassword is not a function 라고 뜨면서 postman이 작동하지 않고있습니다.. 무슨이유일까요 // Login Route 생성 app.post('/login', (req, res) => { // 요청된 이메일을 데이터베이스 안에서 있는지 찾는다 User.findOne({ email: req.body.email }, (err, user) => { if(!user) { return res.json({ loginSuccess: false, message: "제공된 이메일에 해당되는 유저가 없습니다." }) } // 요청된 이메일이 데이터 베이스에 있다면 비밀번호가 맞는건지 확인한다 user.comparePassword(req.body.password, (err, isMatch) => { if(!isMatch) return res.json({ loginSuccess: false, message: "비밀번호가 틀렸습니다." }) // 비밀번호까지 맞다면 토큰을 생성한다. user.generateToken((err, user) => { if(err) return res.status(400).send(err); // 쿠키에 토큰을 저장한다. res.cookie("x_auth", user.token) .status(200) .json({ loginSuccess: true, userId: user._id }) }) }) }) })