Enterprise Project Part 1: Starting

Recently I have been assigned to start a new software project for one of the clients. In this post I have shared my experience on choosing the technology and the strategy. But I would not be possible to disclose the business area of which this software will be used for, to keep the confidentiality. As I was the technical lead, none other than me had to do the crucial sophisticated job, had to start the ball rolling, and had to wrap up everything. It was okay, I enjoyed, doing this often. Every time I had to research and then have to choose latest stable technology stack depending business needs. Also had to take a decision and had to validate my decision.

Technology Stack

I have chosen .Net Core Web API with the Angular front end. But for some obvious reason I have not use .Net default Angular templet. I have separated the projects from each other. Also have chosen Ionic as there was a small part which meant to be a mobile application. So it might be possible to write code using Ionic or to serve the web view via ionic. As there was open Web API I have had the security on mind and have left the communicative security part for the later. And have chosen MongoDB as database, probably would take the benefit to host in Azur CosmosDB later, following some real lucrative staff of the Cosmos DB in recent days. And for caching I have used RedisDB.

According to the business needs the way I have designed, there also had two more extension and for one of the extension I chose as usual .Net Core MVC and MariaDB for the database. The other one was just a console application connected with the same MariaDB of the first extension and with the API of the main application.

Team

After on boarding I have set people in following team

 

Angular Team A
Web API + MongoDB + API Testing Team B
Ionic Team C
.Net Core MVC + MariaDB Team D
.Net Core Console Team E
Angular/UI Testing Team F
Technical Writing Team G

For the project management I normally use Jira and there was no exception this time.

Architecture/ High Level Design

I have described on each topics of the technology used to start. And so far I have decided to divide the blogs in following series

  1. Starting (This Article) – I have already explained the brief introduction, and also going conclude the setting up the Project of Web API
  2. Database Connectivity- In this article I will describe the way to establish connectivity with Mongo and Redis and probably at set of strategy.
  3. Front End – Setting up Angular Project and connectivity with the API will be explained.
  4. API Testing – I will be discussing regarding some tools to be used for API testing.
  5. UI Testing – I will explore some UI Testing tools to test the Angular UI.
  6. DevOps – Some option to integrate continues integration will be explored.

Web API

Let’s create a new the Web API project using VS2017. I have named it as “Example”. As usual the project will be found at GitHub repository.

Web API Visual Studio

It has given us the following files. Let’s navigate to value controller and inspect.

Web API Visual Studio

After running it serves in the following URL

https://localhost:44352/api/values.

If noticed, there is https because the https option was checked when the project was created. A new option of the update. At the startup.cs a new line appeared

For the purpose of the demo to be used in this article I have used the value controller. So getting rid of all the default code my controller looks like this

As the URL was served prefixing “value” I have changed that to the default route by  including an attribute  “[Route(“[controller]”)]” at the top of “[ApiController]”. Have created a simple

And then added a few code in the controller

Then the JSON object is retrievable my calling “https://localhost:44352/values/Hello”  after we run the application. And I am good to go with the basics.

Logging

To get the logging I have added a constructor for the logger to be injected in the controller and added a “ILogger” variable.

And in the Configuration section, have added the following line after add logging service and the parameter.

So the logger is in place and can be called from the action methods of the controller.

Swashbuckle

With this I do not need to use the Postman anymore. It automatically configure the page to test the APIs of our application. Have added that using

Then have added following to the “ConfigureService” and “Configure” method of the startup.cs

and

So the swagger is all set we are good to with that.

Conclusion

So far that is it. As I realized that there are always something which I could not explain why I have done that because then had to write so many things in that case. Like I could easily write one big article on Swashbuckle. I have chosen to write the blogs to share my experiences rather than actual tutorial purpose. But feeling like some things are blurred the way I am writing, so have decided to publish some videos with the next blogs. So I will target to provide a video with each of my blog from the next video. The solution can be found on Git.

Leave a Reply

Your email address will not be published. Required fields are marked *