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

4

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

    
asked by anonymous 18.05.2017 / 22:52

2 answers

7
The SPA (Single Page Application) is an application model whose presentation has a single page that performs Ajax calls to an API in the 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 pattern processes and the return types. MVC renders pages in HTML, usually returning HTML and some other formats, such as XML, JSON, files, and so on, with page transitions being normal 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 paths can return many other file formats (JSON being the most common), and it is not usual to return HTML (even if it is possible).

This is what we call microservices: each resource point (that is, each address) performs a small, very specific function. It's ideal for deploying mobile applications, for example.

By default, the Visual Studio SPA project brings the visual framework 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 other frameworks that work the same way. Some examples:

18.05.2017 / 23:22
2

The .NET Core toolkit SPA template delivers 2 projects in 1. The first is a WebAPI that populates the table that asked, that project WebAPI plays the role of server-side and delivers / receives data to it.

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 because of the limitations that SPA sites have with search engine SEO.

It's a good startup, however I recommend you learn more and setup your project on your own.

Watch this video about the SPA template (in Portuguese): link

    
19.05.2017 / 12:07