abelcastro.dev

Learning Angular by using it on my blog

2023-10-05

TypeScriptRest-APIChatGPTAngular

I wanted to share a little adventure I had while learning Angular. My blog at abelcastro.dev was doing just fine with Django, but I thought, "Why not tinker around with Angular and learn some new skills?" So, I created a playground at ng.abelcastro.dev and decided to see what I could do!

Exploring Angular Fun

Angular is a fantastic toolbox for making web applications more interactive. Even though my blog was working perfectly with Django, I wanted to learn Angular just for the sake of learning, not necessarily to make it look fancier.

Setting Up Angular Playground (ng.abelcastro.dev)

First things first, I set up a separate space for Angular at ng.abelcastro.dev. This way, I could experiment and learn without interfering with the good old Django backend.

Smooth Data Flow with a RESTful API

To make things flow smoothly, I created a pathway for my Angular app to access the blog's data using a RESTful API at `abelcastro.dev/api/posts´ in my Django backend. This API helps Angular fetch blog posts.

The Django Side of Things

In the Django world, I used the Django REST framework to create the /api/posts endpoint. This way, my Angular app can easily fetch the blog post data it needs.

Angular App: Fetching the Data

Inside the Angular app, I used Angular's HttpClient module to fetch data from the Django backend's /api/posts.

Conclusion

You can find the repository for my new angular blog here 🚀.