12 Mar 2020
First API mockup
- Part 1 - Introduction
- Part 2 - Getting Started
- Part 3 - Creating a basic design
- Part 4 - Upgrade to .NET Core 3.1
- Part 5 - Database test
- Part 6 - Create the database
- Part 7 - No architecture deep dive
- Part 8 - This Article
- Part 9 - A new start
- Part 10 - Create the database scripts
- Part 11 - Create the group controller and service
- Part 12 - Running SQL Server in Docker
It has been a while, but the last couple of days I finally made time to invest some time in the football predictions site. Given the current situation with the COVID-19 virus it is unsure if the tournament will be played at all, but for me it much more about the learning process then the actual site itself.
The first thing I implemented is a mockup API to get all the groups. There is no data retrieved from the database yet, so it turned out to be not too difficult.
I created the models for
Country and for now they should be fine.
After that, some instances were created and that is returned by the API.
That is all the endpoint does at this moment. A really basic proof of concept.
Using the API
For that the site needs a be able to output a
That was added as well.
All the tutorials on NSwag I found are Windows-based, using NSwagStudio. Problem is that NSwagStudio is a Windows Desktop application. At the moment most part of my development is done on a Linux machine that won’t work for me. There is a command line interface, but I haven’t tried that out yet.
On the other hand, NSwag can generate its stuff based on compiled code of the server and doesn’t need the output of
That could be a plus. No need to generate a json file.
ng-swagger-gen is a node.js client and we have been using it at the office before.
swagger.json but they advise not to store the generated code in your git repository.
You should generate the code during the build.
It is CI-friendly.
Well, there is not conclusion yet. I need to investigate these two tools and decide which one to use.