This part of the project was written with Angular and was generated with angular-cli.
Install nodejs 18x. Follow the instructions from https://github.com/nodesource/distributions
Clone the project
git clone https://github.com/strmark/kpiradio_frontend.git
Install Angular cli
sudo npm install -g @angular/cli
Install dependencies
cd kpiradio_frontend
npm install --legacy-peer-deps
Run the development server
ng serve --host 0.0.0.0
Navigate to http://server_ip:4200/
. The app will automatically reload if you change any of the source files.
Install nginx web server
sudo apt-get install nginx
Build the project to generate static files
ng build --configuration production --aot
The last command wil generate a "dist" folder. Place it in the nginx web server and give all right to the nginx user
sudo cp -R dist/piradio /var/www/piradio
sudo chown -R www-data: /var/www/piradio
Edit the file default `sudo nano /etc/nginx/sites-available/default` and change the line
root /var/www/html;
with the following content
root /var/www/piradio;
And the line
location / {
try_files $uri $uri/ =404;
}
with the following
location / {
try_files $uri $uri/ /index.html;
}
Pi Radio is now available from the address IP of your Raspberry Pi.