docs-site/content/blog/angular-frontend.md
+++ title = "Creating Frontend Website Using Angular" description = "Setting up a Loco app for serving an Angular clientside app is easy. Learn how to configure and set up a full-stack Angular app with Loco." date = 2024-01-25T18:03:52+01:00 updated = 2024-01-25T18:03:52+01:00 draft = false template = "blog/page.html"
[taxonomies] authors = ["LimpidCrypto"]
+++
.devcontainer/Dockerfileconfig/development.ymlloco new to create a new project.devcontainer/DockerfileFROM mcr.microsoft.com/vscode/devcontainers/rust:0-1
# Install postgresql-client and sea-orm-cli
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends postgresql-client \
&& cargo install sea-orm-cli \
&& chown -R vscode /usr/local/cargo
# Install Node.js and npm
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
&& apt-get install -y nodejs
# Install Angular CLI
RUN npm install -g @angular/cli
COPY .env /.env
The Dockerfile will provide you with everything you need to develop a Loco app with an Angular frontend.
With VSCode it is super easy to reopen and run the project in a Dev Container.
Crtl + Shift + PDev Containers: Repopen in Containerfrontend directoryLoco comes with a Vite React frontend. We can delete the whole directory because the Angular CLI will set up everything we need
ng new frontend to create a new Angular projectng build to build the Angular frontendAs you may have noticed Angular has built the frontend into frontend/dist/frontend/browser. We now need to configure Loco to access the built frontend from there.
Open config/development.yml
Set the configs to the frontend build path:
a. server.middlewares.static.folder.path: "frontend/dist/frontend/browser"
b. server.middlewares.static.fallback: "frontend/dist/frontend/browser/index.html"
cargo loco startYou should now see the Angular starter Website :smile: