Running node Express application as Guest Executable in Service Fabric

If you’re not familiar with Service Fabric it’s an upcoming service offered by Microsoft to host and manage micro services. From the documentation:

Azure Service Fabric is a distributed systems platform that makes it easy to package, deploy, and manage scalable and reliable microservices.

You can read the documentation about how it manages upgrades, failovers, scalability, communication, etc which make it more attractive offering for building large cloud scale apps, but in this article I will be focusing on how to use Service Fabric to host node applications. I do think the new asp.net core has come a long way since initial release candidates and is quite a nice framework for building web APIs but I still think a lot of the innovation such as GraphQL is happening in the node space and it’s good to know how to host those APIs as microservice in Service Fabric as well.

The development experience is quite easy to setup and get running if your using .Net because of the templates and tooling included in Visual Studio but for all other applications that are not .Net they are considered guest executables. They do have a template for getting you started with guest executable but it isn’t a complete solution because you still have to provide the guest application code.

Below I will be creating two basic microservices, one Express.js and one Asp.Net Core so you can see the differences. If you want to follow along or try this out on your own you will need Visual Studio and the Service Fabric SDK and Tools and dotnet core tooling installed.

Hope the video explained how to create add a node service as part of your service fabric application and explained some of the differences in how you configure it compared to the asp.net core application.

I published a repo of all the code shown in the video:

https://github.com/mattmazzola/ServiceFabricExpressAndAspNetCore

One improvement I would have liked to make is to force the express application project to be re-built when building / deploying from within visual studio.

Let me know what you think in the comments!

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store