Design based on the VS2015 spa template. How the service is generated

Asked

Viewed 83 times

5

I created a project using the SPA template in Visual Studio 2015, to learn and understand, but I found this example very complicated. I still don’t understand where the service is mounted and loaded?

  • What service are we talking about?

  • @Ciganomorrisonmendez, hello, when we click on the template’s API button it opens a screen with an already populated grid. I believe that to popular the grid, is a service that does this, so is this service. I confess, I’m floating like shit in Tietê.

  • I’ll give you an answer, but the best thing would be for you to take a course to apply the concepts. I have a, be interested.

  • I found it interesting your course, the problem right now would be how to pay even, because I am without a job, you know how and.

  • All right. When you can, just looking for me.

2 answers

8


The template SPA (Single Page Application, Single Page Application) is an application model whose presentation features a single page that performs Ajax calls to an API in ASP.NET Web API.

The Web API standard is explained here.

The difference between Web API and MVC is basically the type of request that each standard processes and the types of returns. MVC processes HTML pages, normally returning HTML and some other formats such as XML, JSON, files, and so on, and it is normal for a page to transition between one address and another.

The Web API implements a standard called REST, which MVC implements as well, but in a more specialized way. Web API routes can return many other file formats (JSON being the most common), and it is not usual to return HTML (although it is possible).

This is what we call Microservices: each resource point (i.e., each address) plays a very specific small function. It is ideal to implement mobile applications, for example.

By default, the SPA project of Visual Studio brings implemented the framework visual Knockout.js. What it does is structure calls to this Web API (which is also part of the system) and the API returns information in JSON format. Through Javascript, this framework receives the data, interprets and produces a visual result without loading another screen or changing address.

There are several others frameworks work in the same way. Some examples:

3

The . NET Core SPA Tooling Template delivers 2 projects in 1. The first is a Webapi that fill the table you asked, this Webapi project plays the role of the server-side and delivers/receives data.

The actual SPA project (depending on the framework you choose) will be in a folder at the root of the Webapi project. This template uses a Microsoft implementation to preload the site files (SPA) this preloading is beneficial due to the limitations that SPA sites have with search engine SEO.

It’s a good startup, but I recommend you learn more and set up your project on your own.

Watch this video about the SPA template (in Portuguese): https://youtu.be/_Hff8uul25e

  • Thanks Eduardo, I’ve been watching your videos yes. It’s just that there are a few things in the project that is half dark to see.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.