inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

따라하며 배우는 노드, 리액트 시리즈 - 유튜브 사이트 만들기

비디오 디테일 페이지 만들기

VideoDetailPage로 넘어갈 때 404 error

232

귀여운 북극곰

작성한 질문수 0

0

랜딩페이지 로드할 때 DB에서 비디오 정보 가져올 때는 오류 없어 잘 돼는데

이상하게 디테일페이지에서 불러올때는 노드쪽(?) path 가  undefined 가 뜨네요ㅜㅜ 

오른쪽에 6032...저게 비디오 아이디랑 똑같은데 왜 저렇게 뜨는지 못찾겠어서요..!

페이지 로딩은 됩니다.. 영상 썸네일? 은 뜨는듯한데 재생은 또 안되구요..ㅜㅜ

그리고 어쩔때는 videoDetail이 이예 넘어오질 않습니다.

node 쪽 콘솔로 정보가 잘 왔는지 찍어보면 req.body 에 variable 이 없어요ㅜㅜ 깃헙 주소 남깁니다!

영상은 .mov 인데 이거는 비디오 업로드 시에 .mp4 와 || .mov 둘다 가능하게 작성하긴 했습니당

https://github.com/silverwest8/YoutubeCLONE

답변주시면 정말 감사하겠습니다!😀

404error react redux mongodb nodejs

답변 1

0

John Ahn

은서님 안녕하세요 답변이 너무 늦었네요 ㅠㅠ.... 혹시 이부분 해결하셨나요? 

0

귀여운 북극곰

아닙니다!! 감사합니당 ㅎㅎ

아뇨ㅜㅜ 아무리 검색하고 삽질해도 req가 안넘어오는건 body-parser 때문이라는데

노드쪽 index.js 에 .json() 과 urlencoded()가 다 잘 되어있는데 왜 안되는지 모르겠네요...

아예 안되는것도 아니고 랜딩페이지 비디오 로딩은 잘 되다가 디테일페이지에서만 안되는 이유를 못찾고 있습니다!

너무 오래걸려서 일단 구독 부분으로 넘어가서 계속 하고 있는데 구독부분 구현에서도 req.body 가 그냥 [Object object]로만 떠서 어떻게해야할지 모르겠습니다.!

깃헙주소는 https://github.com/silverwest8/YoutubeCLONE 이고, 

한번 봐주실 수 있으면 감사하겠습니다!

 아래는 index.js파일입니다

const express = require("express");const app = express();const path = require("path");const cors = require('cors')const bodyParser = require("body-parser");const cookieParser = require("cookie-parser");const config = require("./config/key");// const mongoose = require("mongoose");// mongoose// .connect(config.mongoURI, { useNewUrlParser: true })// .then(() => console.log("DB connected"))// .catch(err => console.error(err));const mongoose = require("mongoose");const connect = mongoose.connect(config.mongoURI, { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true, useFindAndModify: false }) .then(() => console.log('MongoDB Connected...')) .catch(err => console.log(err));app.use(cors())//to get json data// support parsing of application/json type post dataapp.use(bodyParser.json());//to not get any deprecation warning or error//support parsing of application/x-www-form-urlencoded post dataapp.use(bodyParser.urlencoded({ extended: true }));app.use(cookieParser());app.use('/api/users', require('./routes/users'));//videouploadpage 에서 여기로 왔다가 route로 감app.use('/api/video', require('./routes/video'));app.use('/api/subscribe', require('./routes/subscribe'));//use this to show the image you have in node js server to client (react js)//https://stackoverflow.com/questions/48914987/send-image-path-from-node-js-express-server-to-react-clientapp.use('/uploads', express.static('uploads'));// Serve static assets if in productionif (process.env.NODE_ENV === "production") { // Set static folder // All the javascript and css files will be read and served from this folder app.use(express.static("client/build")); // index.html for all page routes html or routing and naviagtion app.get("*", (req, res) => { res.sendFile(path.resolve(__dirname, "../client", "build", "index.html")); });}// const port = process.env.PORT || 4000;// const port = 4000 || process.env.PORT;const port = 4000;app.listen(port, () => { console.log(`Server Listening on ${port}`)});

npm i하면 바로, 라이브러리 오류없이 받아지고, 구동되는 소스는 없나요?

0

52

1

ERROR in ./node_modules/antd/es/version/index.js 2:15-22

0

221

1

자료 없음

0

321

1

이미지 깨짐

0

335

1

npm run dev 동작 에러

0

304

1

npm run dev 동작 에러

0

294

1

npm run dev 동작에러납니다...

0

660

1

npm run dev 실행 오류

0

653

1

비디오 업로드, 로그인, 회원가입 504 error

0

1056

1

시작부터 오류생기시는 분들 해결법입니다.

1

466

1

오류 해결 공유

0

458

1

npm install 에러 질문드립니다.

0

1120

2

아예 몽고DB에 연결한다고만 하고 연결이 안되고 있습니다.

0

550

1

해당 오류 해결 방법 좀 알려주세요 ㅠㅠ

0

515

1

로컬스토리지에 대한 질문입니다!!

0

515

0

video가 안 나타나는 문제

0

893

1

ffmpeg 설치 후 cannot read property 'format' of undefined 500 에러 해결

0

470

0

typeError or 콘솔 500 뜨는분..

0

336

0

npm run dev 관련 오류

0

578

1

답글이 달리지않고 디비에도 저장되지않으며 새로고침이 됩니다.

0

246

0

useState 자동 생성

0

345

1

TypeError: Cannot read properties of undefined (reading 'format')

0

1246

2

userData undefined / state에 user.userData가 없습니다.

0

247

0

antd Input background color 변경

0

241

0