Loco with Angular #218
Replies: 4 comments 4 replies
-
This is more of a tutorial on how I set up an Angular frontend with the Loco backend. I hope this can help someone :) |
Beta Was this translation helpful? Give feedback.
-
Hello, @LimpidCrypto! This is fantastic! I'm confident we can find a valuable use for it. Why did you close the discussions i think we have a lot to talk :)
|
Beta Was this translation helpful? Give feedback.
-
Hey @kaplanelad this was just meant to be a short tutorial. I'm happy to discuss about it :) This is the first time I use Loco. I was just about to start a similar project, as I couldn't find anything similar, which is to Rust what Laravel is to PHP. So yesterday I discovered this awesome framework. I haven't seen the todo-list repo yet. Thanks for pointing it out to me :) |
Beta Was this translation helpful? Give feedback.
-
Awesome, thanks for putting this together! Cannot wait to see this for Flutter ;) |
Beta Was this translation helpful? Give feedback.
-
Loco with Angular
Overview
.devcontainer/Dockerfile
frontend
directoryconfig
Edit
.devcontainer/Dockerfile
Reopen the project in the Dev Container
With VSCode it is super easy to reopen and run the project in a Dev Container.
VSCode will open the project in the Docker container. This can take a while when it is built for the first time.
Delete
frontend
directoryLoco come with a Vite React frontend. We can delete the whole directory because the Angular CLI will set up everything we need
Generate new Angular frontend
From the project root execute
ng new frontend
and follow the instructionsBuild frontend
Run
ng build
to build the Angular frontendEdit
config
As you may have noticed Angular has built the frontend into
frontend/dist/frontend/browser
. We need to set that path for Loco config. Navigate toconfig/development.yml
and set the following config:server.middlewares.static.folder.path: "frontend/dist/frontend/browser"
server.middlewares.static.fallback: "frontend/dist/frontend/browser/index.html"
Start Loco
Run
cargo loco start
and open http://localhost:3000/You should now see the Angular starter Website :)
Beta Was this translation helpful? Give feedback.
All reactions