Haven't got any code updates, but it's worth doing a quick entry just update where I'm at, and to clarify the next steps...
Right now I'm looking at beautifying the UI. I'd originally assumed I'd use Material Design since I like its aesthetics, I'd used it successfully in a previous project. But now I'm having second thoughts for two reasons...
Since the project is still in a very simple state, I'll probably build UI examples using both frameworks (if I can find the patience to get Material Design working), and decide between them after that. Following that the next steps will be...
Github tag 0.3.0.0
Continuing with CORS configuration, and overcoming the 'Cross-Origin Request Blocked' errors I was getting from Firefox in my previous post... I realized my understanding of CORS, and specifically where the 'Access-Control-Allow-Origin' headers needed to be was not 100% correct. I was under the impression it was the UI/front-end HTTP response which should include these headers... i.e. the front-end nominating which URL(s) it was expecting to connect to, and in doing so, protecting the front-end code from accessing malicious backend services (e.g. as could be a problem for websites which have dynamic injected content from 3rd parties like banner ads). However, according to this Microsoft article, matching 'Access-Control-Allow-Origin' headers need to be set on the backend/API HTTP request and response messages. The goal of CORS is actually to protect a backend service from being accessed by front-end code which it doesn't know about, or doesn't allow.
Through experimenting and trying to figure out how to make this all work, I noticed that the HTTP requests sent from the NodeJS server hosting the UI/front-end pages (from the 'ng serve' command), seem to be including the correct 'Origin' header out of the box...
So, at the end of the day, all that needs to be done to get things working is to have the .NET code send the correct 'Access-Control-Allow-Origin' headers in its HTTP responses. Configuring this in .NET Core is dead simple following Microsoft's instructions (see changes to Startup.cs)... although be careful not to do as I did, and mistakenly follow the equivalent instructions for regular (non-Core) ASP.NET, and then spend an hour trying to figure out why things don't see to be working!
The backend services are now returning the following HTTP responses...
Having CORS configured simply like this is good. The application front-end could be hosted using several different technologies (IIS, Apache, NodeJS), and the NodeJS instance that's used by the Angular 'ng serve' command for local development will likely not be the same technology I use for test and production deployment. Hence if CORS config had to happen in the front-end code (or more correctly in the front end infrastructure), I'd have to figure out a nice way configure it properly for multiple different technologies, which would add to the complexity of the deployment process. By contrast the backend code will always be running in .NET Core hosted by IIS (even if I use AWS Elastic Beanstalk or Azure Web Apps, these are still just VM and infrastructure 'wrappers' around an IIS instance), so having the CORS configuration here means I can just use the same simple configuration for local, test, and production deployments. What I'll have to do at some stage is move the CORS configuration into external config (not hard coded as it is atm).
For next steps, I probably want to start building the deployment code around the current very simple code base (i.e. likely Jenkins workflows to deploy the current code base to AWS)... it's going to be important to keep both the application code, and the devops/deployment stuff move along in parallel. But I've also been reading a bit about WebAssembly... and am very keen to see if I can get some .NET code running in the browser side. This is a very exciting development, and I think opens up a lot of potential to simplify web applications (as a very simple example... writing a single library of ui/form validation code that can be run in the client and on the server). So, I might take a small detour, to see if I can get a simple example of this up and running.
Github tag 0.2.0.0
I've setup a very basic page in Angular which shows the pixels of 3 different sample MNIST digits...

The two buttons at the bottom allow loading the MINST image from either the local Angular DigitImageService or from the remote .NET API Controller (via a call to httpClient.get()). Getting the image from the local service works fine... clicking on the 'Get From API' button results in the following error in Firefox...
In this case the Angular code was running through the 'ng serve --open' command, which hosts the Angular frontend through node.js, running on port 4200. The Web API was running through Visual Studio and IIS Express on port 9000. From the error message we can see that Firefox has blocked access to content running on a different port (i.e. on 9000) due to CORS.
The next step will be to set appropriate CORS headers in the response from the frontend page requests to allow access to the Web API. At the most basic level this should just require response headers to include the following...
... but may get more complex if Firefox is sending preflight HTTP OPTIONS calls.
The interesting bit will be how to set these response headers... I don't know whether it's possible to configure in the node.js instance started up by 'ng serve'... another option might be to host the Angular files through Visual Studio / IIS (if ultimately I host the frontend through elastic beanstalk this would be closer to the 'end state').
In any case, this CORS header configuration will be the next step.
Github tag 0.1.0.0
OK... my first post. My aim with this project was to try and blog regularly, but even though I've been scribbling down ideas and writing bits of code for 4-5 days, I still haven't collected a set of cohesive thoughts into a post... until now!
My first goal is to get a very rough framework of the main components of TryML up and running. One thing I'm conscious of (and which I think I mentioned in the intro) is that I want to keep the architecture very decoupled, and make sure I've got a lot of flexibility in deploying in different configurations with minimal change. Specifically, at a high level I want to have modular front-end, service layer, and storage/cache components which can be deployed in configurations ranging from everything being in a single VM on my laptop, to having all components separated and distributed on AWS (or another cloud provider) utilizing auto-scaling, load balancing, etc. So as a first step I want to create...
Starting with this very basic context will allow me to experiment with, and decide on a couple of items which will have a greater effect on the overall design... specifically...
Anyway, just to get the ball rolling, I've built a Web API project with a single endpoint (api/DigitImages/{id}) which serves up the pixels of 3 different MNIST images, and also created a shell Angular workspace and application. The next step will be to build a single Angular page (plus appropriate routing and service) to retrieve a selected image and display it. Then I can start playing around with CORS, and see what's possible.