This is a simple project to experiement with youtube api and react server side rendering.
To see demo: https://murmuring-beach-19954.herokuapp.com/
Install dependencies with
npm install
Run dev mode with
npm run dev
Test locally: http://localhost:2048
Video Schema
{
_id: primary ID,
videoId: String, // video Id used to display video
title: String,
poster: String // thumbnail url
}
App: root component that handles most of the state management and action calls
List: creates a list of recomended videos from search and recently viewed history
Video: displays video and its comments when clicked
This part is the only part that's not server side rendering. It is the entry file for webpack to create bundle.js to ran on the client. Css are loaded using css-loader
. The bundle file can be found in dist folder.
Helper function that implements google youtube api
Setup server and api
GET /videos: return 10 top most recently viewed videos
POST /videos: save a revently viewed video
This is the entry file to start node server. This file loads the babel-register and sets up the babel plugins needed to run JSX and ESModules on the server.
node index.js
This project deploys to heroku using mongodb addon
"scripts": {
"heroku-postbuild": "webpack",
"start": "node index.js",
}