Link to Video Demo: https://youtu.be/OUh0-8NdVss
This project was initiated on January 21, 2023, and finished on April 11, 2023.
• Technologies used in this Project
• Commands for this Application
• Setting up the YouTube API to your Local Repo
• Vuex (Vue's State Management Library)
• Vuex-Persistedstate Library
• Vue Watcher
Before you run this app, install the dependencies first, by running this command:
npm install
Command to run this app:
npm run serve
To watch changes in tailwind in case you are modifying it:
npx tailwindcss-cli build -i ./src/input.css -o ./dist/output.css --watch
Note: If you tried to modify the Tailwind and it didn't work, please try to restart the Vue server.
I've placed the API key in dotenv for security purposes, so in this part of README.md, I will guide you on how to setup your own key and gain access to the YouTube API.
mounted(){
const API_KEY = process.env.VUE_APP_API_KEY;
let max_results_length = 16
let url = `https://youtube.googleapis.com/youtube/v3/search?part=snippet&maxResults=${ max_results_length }&key=${ API_KEY }`;
YouTubeAPI.get(url)
.then(response => {
console.log(response);
})
.catch(err => {
console.log(err);
});
}
This application uses Vuex
to handle the data shared through all of the components. Madriñan Computer Laboratory conducted an experiment to better understand this before implementing it here. You can access the repository of the experiment, just click this link.
vuex-persistedstate
library was used in this project, this is used to prevent the state object from resetting if the page reloads.
Sources for this:
• https://stackoverflow.com/questions/43027499/vuex-state-on-page-refresh
• https://www.npmjs.com/package/vuex-persistedstate
This project implements a watcher
and this project use this to removed the cached video data when the URL
changes.
The following link are the reference for watcher
:
• https://stackoverflow.com/questions/46402809/vuejs-event-on-route-change
• https://vuejs.org/guide/essentials/watchers.html#basic-example
Stay tuned for upcoming projects and experiments by following me on the following accounts: