Skip to content

The application that provides the Protopolis with epic tunes!

Notifications You must be signed in to change notification settings

saproto/ProTube

Repository files navigation

Proto logo
ProTube

ProTube Node.js back-end
Providing S.A. Proto with awesome tunes!
issues badge contributors badge open source badge

Contributors

Here you can find the people that have contributed to the code of this project. But, let's not forget the other members of the HYTTIOAOAc!

Prerequisites

This application requires Node.js and npm. It is highly advised to use nvm to manage your Node.js versions.

⚠️ ATTENTION
Tor run this project locally you also have an instance of the Proto website running on your system for authentication of a user.

To run this project you need some kind of database to connect to Node.js server. If you already have followed the setup for the Proto website instance you probably already have Docker setup on your system. Included in this project is a docker-compose.yml file to quickly set up a mysql database.

Installation

Node.js version

Open up a terminal and make sure you have the correct version of Node.js as specified in .nvmrc. If you have nvm, you can run:

nvm use

to make sure you have the correct version.

Dependencies

Now, install the project dependencies with npm using the following command:

npm install

Environment variables

To set your environment variables correctly, first copy .env.example as .env:

(cd server && cp .env.example .env)

Now edit your .env file in the server directory to make sure all the variables are set correctly. On your local Proto website instance you might also need to create a new OAuth2 client if you haven't already or, you recently refreshed the database.

Creating an OAuth client

To create a new OAuth client, you can run sail artisan passport:client in the directory from where you run your Proto website instance. This command will prompt you with a couple of settings:

  • User ID: 1
  • Name: protube
  • Callback: https://localhost:3000/api/login/callback

The above command will return a Client ID and Client Secret which you can add to your ProTube server .env file.

After this it might be necessary to run sail artisan passport:keys to generate oauth encryption keys for your Proto website.

Running the development server

For the database you first need to start the mysql docker container:

(cd server && docker-compose up)

To start the dev server:

npm run dev

This should start the development server on localhost:3000 or whatever port was set in .env. On this host the following pages are available:

  • Screen: /screen
  • Screen (with code): /screen/admin.
  • Remote: /remote
  • Admin remote: /remote/admin

Vue Devtools

For debugging purposes it is highly recommended to install the Vue Devtools. You can start the Vue Devtools by inspecting the page and moving to the Vue tab, here you can see out of which components the site is built, which props are passed, view and modify variables e.g.

Note: Vue Devtools only work in dev mode