question

DarrenRose-2607 avatar image
0 Votes"
DarrenRose-2607 asked DuaneArnold-0443 commented

Discussion on best way to create a "backend" for my apps

Hi

Over the years I have written many apps for myself and for customers using VB.NET, most of these were standalone apps which worked on workstations and servers and didn't involve much if anything to do with networking, client/server or a backend.

I want to evolve and learn more, and specifically am interested in creating a "backend" for some of my apps so that the data from the client app, whether it be error information or custom data for a client can be sent from the "client" to whatever is the best option for the "backend". I would then store the received data in a database I assume and then have ability to view it, and parse the data to show specific results etc

This is a new area to me but one I want to learn more about, so I am hoping that others who have this knowledge / experience can give me some pointers as to the best route to take etc, especially covering the points below and anything else you think I need to know but have missed

1) What to use for the "backend"? I prefer to have it in the cloud rather than having my own server, so do I use something like Azure? if so what? or do I sign up for hosting with a company which provided ASP and .NET Core hosting and create something there? if so what would I use?

2) What are the best methods for sending data from a to b - I notice most services I currently use for my apps e.g. for sending mail or error reports etc often use JSON? is that best option?

3) How do I send the data, any built in or suggested frameworks or API's to use to "post / send" information from my client to my backend / remote endpoint?

Hope this all make sense, please ask if not, all comments appreciated, as I say I want to use this both as a way to create / modernize some of my existing apps, but also as a learning exercise to learn areas I don't know and hopefully also make user of newer / evolving technologies and solutions.

Thanks

dotnet-visual-basic
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ryanchill avatar image
1 Vote"
ryanchill answered ryanchill commented

Hi @DarrenRose-2607,

You have certainly asked a loaded question 😊. I would review https://docs.microsoft.com/en-us/azure/architecture/guide/architecture-styles/n-tier, https://docs.microsoft.com/en-us/azure/architecture/patterns/backends-for-frontends as well as other various guides and blog posts related to this architecting style.

1) What to use for the "backend"? I prefer to have it in the cloud rather than having my own server, so do I use something like Azure? if so what? or do I sign up for hosting with a company which provided ASP and .NET Core hosting and create something there? if so what would I use?

Sure, there are many database offerings; see https://azure.microsoft.com/en-us/product-categories/databases/ are available. You just decide which one from a performance and cost standpoint, best meets your needs.

2) What are the best methods for sending data from a to b - I notice most services I currently use for my apps e.g. for sending mail or error reports etc. often use JSON? is that best option?

The easiest way is to use JSON because of its popularity and simplicity. Moreover, most major frameworks send objects over HTTP as JSON by default.

3) How do I send the data, any built in or suggested frameworks or API's to use to "post / send" information from my client to my backend / remote endpoint?

This will be up to you and what you're most comfortable with learning and using. If you're use to Visual Basic, C# would probably be the easiest transition. Python might be another easy transition, but I wouldn't limit yourself; just do what's comfortable and cool to you.
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, thank you very much for your answer, I will take a look at the links over the weekend and research further as suggested.

I was hoping to find some sample apps so I can see how they send data from a to b using say JSON, or perhaps there is an existing library I can use to handle this part.

It does seem I am going to have to start learning C# as most of the new versions of everything from Microsoft relating to .NET etc seem to be leaving out us VB users.

Thanks again

P.S. It doesn't have to be Azure, as the host I used for my websites also supports ASP or .NET Core hosting which I assume I could use as well somehow

0 Votes 0 ·

You can certainly browse code samples, but you can start with https://docs.microsoft.com/en-us/samples/azure-samples/azure-sql-db-dotnet-rest-api/azure-sql-db-dotnet-rest-api/ which is C# ASP.net application demonstrating how to safe JSON object data to an Azure SQL hosted instance.

Psst there's many more samples that traverse languages and frameworks 😊


1 Vote 1 ·
DuaneArnold-0443 avatar image
2 Votes"
DuaneArnold-0443 answered DuaneArnold-0443 commented

The best way IMHO is to host an ASP.NET WebAPI, a restful Web service, that has a data access layer DAL sitting behind it using the DAO and DTO patterns.

https://gunnarpeipman.com/aspnet-core2-vbnet-weather-api/

https://en.wikipedia.org/wiki/Data_access_object

https://javarevisited.blogspot.com/2013/01/data-access-object-dao-design-pattern-java-tutorial-example.html

DTO(s) travel between layers, tiers and client/service programs.

https://www.codeguru.com/vb/gen/vb_misc/oop/article.php/c7063/Data-Transfer-Object-Pattern-Goes-VBNET.htm

https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/procedures/auto-implemented-properties

The WebAPI client can be any type of client like Windows desktop, WPF console program etc., and etc.

The DAL using DAO can be using any type of technology, becuase it's using the DTO pattern and the client-side only sees or knows about the DTO(s)

Here is a Github VB.net MVC client using a WebAPI for CRUD with the database you can examine, which is using WebAPI 2.

https://github.com/darnold924/ProgMgmntVB

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you, much appreciated, will have a look at the links over the next few days :)

0 Votes 0 ·

If you have any questions feel free to ask.

0 Votes 0 ·