This part of the project was written with Angular 7 and was generated with angular-cli version 7.3.5. It is now updated to Angular 18.
Install nodejs 18x
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
node --version
Clone the project
git clone https://github.com/strmark/piclodio4.git
Install Angular cli
sudo npm install -g @angular/cli
Install dependencies
cd piclodio4/front/
npm install --legacy-peer-deps
If your Pi runs out of memory export the following NODE_OPTION
export NODE_OPTIONS="--max-old-space-size=1024"
Run the development server (for testing purposes). If you want to install the frontend continue with the next step Install nginx web server)
ng serve
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/piclodio /var/www/piclodio
sudo chown -R www-data: /var/www/piclodio
Edit the file default.conf `sudo nano /etc/nginx/sites-available/default` and change the line
root /var/www/html;
with the following content
root /var/www/piclodio;
And the line
location / {
try_files $uri $uri/ =404;
}
with the following
location / {
try_files $uri $uri/ /index.html;
}
Piclodio is now available from the address IP of your Raspberry Pi.