Today, we enter a new phase of the The Globe In My Bucket Application (TGIMBA) .NET Core rewrite. I am very excited because it took me a lot longer to get the Continuous Integration/Continuous Deployment (CI/CD) pipeline in place working the way I want. It is not perfect yet as when I do a deploy with existing files on my production site, it stalls because some of the .dll files are still in use. I hope to eventually figure out why this is the case as I can delete them manually. But for now, I really want to move on to the fun part of this 🙂
Another change I am going to make is not to remove the Angular 4 Type Script files. I am hoping that I am missing something with the node_modules folder requirement and I can still do that layout. I made an interesting discovery while adding some static files. I did not know that static files were not available by default. So, I read a couple of articles and this one (reference #1) talked in more detail about the wwwroot in the project as well as the use of app.UseStaticFiles(). Essentially, placing any static files in the wwwroot and calling UseStaticFiles() in Startup.cs makes them available.
If this is the case, I will also no longer need the extra node install step on my CI/CD pipeline 🙂 After putting this call in Startup.cs, all my Angular views started showing up and working.
On to business 🙂
To organize things a bit, I am going to create a Markup folder with views and another corresponding one under Scripts.
To access this, I have to put an entry point from the .NET Core application. I add a HtmlVanillaJsIndex() action to HomeController.cs.
The null/undefined check is handled in Utilities.js
If there is an error, it is handled in ErrorHandler.js.
The load of main.html (thanks to reference #4) is handled in ServerCalls.js
Putting it all together: