Month: December 2022

Dart and Nginx

I’ve been enjoying Flutter a lot. I’ve written a couple of apps, and I’m getting a good handle on the dart language. Now, I’d like to use dart for the whole system rather than having half of my code in PHP and the other half in Dart/Flutter.

I found the solution in Dart Shelf. The code is hosted at GitHub, and it can easily be installed as any other Dart package.

The best use case is that I can have a shared package between the Flutter front-end and the Dart shelf back-end. So, I can create, for example, a Transaction class that represents a transaction in my system. I can give the class toJson() and fromJson() methods that will convert between a Json-formatted string. Then, I can easily send it from the Flutter front-end to the back-end and have the same code running on both sides. I only maintain it in one place.

So, I learned how to make all that work pretty quickly. The challenge is how do I push that out onto a server already setup as a website. The server is using Nginx, and I don’t want to replace all the other stuff that Nginx is already doing.

Read More