Giter VIP home page Giter VIP logo

wetube-reloaded's Introduction

Wetube


🌐 ν”„λ‘œμ νŠΈ 링크

Wetube λ°”λ‘œκ°€κΈ°


  • μ–Έμ–΄ : JavaScript(ES6)
  • ν”„λ‘ νŠΈ : SCSS, PUG
  • λ°±μ—”λ“œ : NodeJs, MongoDB, Express
  • 배포 : AWS S3, Mongo Atlas, Fly.io
  • 라이브러리 : npm, WebPack, Mongoose, babel, express-session, multer, FFmpeg λ“±

βš™οΈ κΈ°λŠ₯ μ„€λͺ…

  • User
    • κΉƒν—™ openAPI λ₯Ό μ΄μš©ν•œ μ†Œμ…œ 둜그인 κΈ°λŠ₯
    • μ„Έμ…˜μ„ ν†΅ν•œ 둜그인/ λ‘œκ·Έμ•„μ›ƒ κΈ°λŠ₯
    • ν”„λ‘œν•„ μˆ˜μ •(사진, λ‹‰λ„€μž„ λ“±) κΈ°λŠ₯
  • Video
    • λ™μ˜μƒ/ 이미지(섬넀일) μ—…λ‘œλ“œ κΈ°λŠ₯(AWS S3)
    • λ™μ˜μƒ λ…Ήν™” 및 λ…Ήν™”ν•œ μ˜μƒ λ‹€μš΄λ‘œλ“œ & 썸넀일 λ‹€μš΄λ‘œλ“œ κΈ°λŠ₯(FFmpeg)
    • λ™μ˜μƒ 쑰회수 κΈ°λŠ₯
    • λ™μ˜μƒ μˆ˜μ • 및 μ‚­μ œ κΈ°λŠ₯
    • (ν™”λ©΄μ—μ„œ λ³΄μ΄λŠ” μ’‹μ•„μš”, μ‹«μ–΄μš”λŠ” κΈ°λŠ₯λ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€..🀣)
  • κ·Έ μ™Έ
    • λŒ“κΈ€ μΆ”κ°€ 및 μ‚­μ œ κΈ°λŠ₯
    • μ˜μƒ 제λͺ© 검색 κΈ°λŠ₯

πŸ“ ν”„λ‘œμ νŠΈ ꡬ쑰

-πŸ“‚[src]
➑[client] ➑️ js   ―  js 폴더 (videoEvent)
➑[client] ➑️ scss   ―  css 폴더
➑[controllers]γ€€γ€€β€•γ€€μ‚¬μš©μž μš”μ²­/응닡 처리 폴더
➑[models]  ―  DB model 폴더
➑[routers]γ€€γ€€β€•γ€€μ‚¬μš©μž μš”μ²­/응닡 λΌμš°ν„° 폴더
➑[views]  ―  PUG ν…œν”Œλ¦Ώ 폴더
➑db.js   ―  mongoose DB μ—°κ²°
➑init.js γ€€γ€€β€•γ€€μ„œλ²„ μ‹€ν–‰
➑middlewares.js   ―  express middleware
➑server.js   ―  express μ„œλ²„ μ„ΈνŒ…


πŸ“– 배운점? μ„±κ³Ό?

  • ES6 버전을 κ³΅λΆ€ν•˜λ©°, Arrow function κ³Ό async/await 와 같은 비동기 ν•¨μˆ˜ μ²˜λ¦¬μ™€ 같은 차이점에 λŒ€ν•΄ μ•Œ 수 μžˆμ—ˆμŠ΅λ‹ˆλ‹€.
  • FFmpeg, AWS S3 λ₯Ό μ‚¬μš©ν•˜λ©° CORSλž€ 무엇이며, ν•„μš”μ„±, 문제 ν•΄κ²° 방법에 λŒ€ν•΄ ꡬ체적으둜 곡뢀할 수 μžˆμ—ˆμŠ΅λ‹ˆλ‹€.
  • Mongoose 의 schema & model 에 λŒ€ν•΄ κ³΅λΆ€ν•˜λ©° λ°±μ—”λ“œμ˜ ꡬ쑰에 λŒ€ν•΄ 배울 수 μžˆμ—ˆμŠ΅λ‹ˆλ‹€. μ–΄λ ΅μ§€λ§Œ 직접 λͺ¨λΈμ„ μ„€κ³„ν•˜κ³  ꡬ쑰λ₯Ό μž‘μ•„κ°€λŠ” 과정이 μ¦κ±°μ› μŠ΅λ‹ˆλ‹€ πŸ™‚

❗가μž₯ μ–΄λ €μ› λ˜ 것, ν•΄κ²° κΉŒμ§€

  • MongoDB Atlas + AWS S3 μ„œλ²„λ₯Ό μ‚¬μš©ν•˜λŠ” 것은 μ²˜μŒμ΄λ‹€λ³΄λ‹ˆ 어렀움이 λ§Žμ•˜μ—ˆλŠ”λ°,
    특히 λ™μ˜μƒ λ…Ήν™” 및 λ³€ν™˜ 라이브러리인 FFmpeg 와 AWS S3 의 Same Origin Policy 정책이 λΆ€λ”ͺν˜€
    정상적인 μž‘λ™μ΄ μ•ˆ λ¬μ—ˆλ‹€. 처음 맞던 CORS μ •μ±… 였λ₯˜μ˜€λ‹€.

  • FFmpeg λŠ” λ³΄μ•ˆμ„ μœ„ν•΄ μΆœμ²˜κ°„ 격리된 νŽ˜μ΄μ§€μ—μ„œλ§Œ μ‚¬μš©μ΄ κ°€λŠ₯ν•˜λ‚˜,
    아바타 URL 은 AWS S3 μ—μ„œ, κ·ΈλŸ¬λ‹ˆκΉŒ λ‹€λ₯Έ μΆœμ²˜μ—μ„œ 이미지λ₯Ό 가져와야 ν–ˆλ‹€.

  • 이에 CORS λž€ 무엇인지, 기초λ₯Ό λ‹€μ‹œ κ³΅λΆ€ν–ˆκ³ 
    두 가지 정책이 λΆ€λ”ͺνžˆμ§€ μ•Šλ„λ‘ ν•  수 μžˆλŠ” CORS 정책에 λŒ€ν•΄ κ³΅λΆ€ν•œ κ²°κ³Ό,
    COEP λ₯Ό credentialless 으둜 μ„€μ •ν•˜μ—¬ 문제λ₯Ό ν•΄κ²°ν•  수 μžˆμ—ˆλ‹€.

    πŸ“•μ—λŸ¬λ…ΈνŠΈ_CORS 였λ₯˜ ν•΄κ²°(2) feat. SharedArrayBuffer

  • μ•„λž˜λŠ” λ¬Έμ œκ°€ λ°œμƒν–ˆλ˜ server.js 의 λΆ€λΆ„.

// κΈ°μ‘΄ μ½”λ“œ

app.use((req, res, next) => {
  res.setHeader("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Credentials", true);
  res.header("Cross-Origin-Embedder-Policy", "credentialless");
  next();
});

// μˆ˜μ • ν›„ 정상 λ™μž‘

app.use((req, res, next) => {
  res.header("Cross-Origin-Embedder-Policy", "credentialless");
  res.header("Cross-Origin-Opener-Policy", "same-origin");
  next();
});

🀯  디벨둭 μ˜ˆμ •

  • λ°˜μ‘ν˜• μ›Ή λ””μžμΈ, 크둜슀 λΈŒλΌμš°μ§•!
  • 넀이버 openAPI μ†Œμ…œ 둜그인 κΈ°λŠ₯ κ΅¬ν˜„
  • λ™μ˜μƒ μ’‹μ•„μš”, μ‹«μ–΄μš” κΈ°λŠ₯
  • ν•΄μ‹œνƒœκ·Έλ₯Ό 톡해 μ˜μƒμ„ κ²€μƒ‰ν•˜λŠ” κΈ°λŠ₯

wetube-reloaded's People

Contributors

leesugyoung avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.