1. Trang chủ
  2. » Giáo Dục - Đào Tạo

2 asp dotnet core api building first m2 slides kho tài liệu training

24 57 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 24
Dung lượng 256,15 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

This bullet list... This slide is with animations Model-View-ControllerArchitectural pattern Loose coupling, separation of concerns: testability, reuse Not the full application architec

Trang 2

This bullet list

Trang 3

ASP.NET Core MVC

ASP.NET MVC

(client-facing web applications)

ASP.NET Web API

(http services)

Middleware for Building an API

Trang 4

This slide is

with

animations

Model-View-ControllerArchitectural pattern

Loose coupling, separation of concerns: testability, reuse

Not the full application architecture!

Clarifying the MVC Pattern

Trang 5

Model

Trang 6

Clarifying the MVC Pattern

Consumer of the API

Resource representation

(often JSON)

Model

Trang 9

This slide is

with

animations

Matches request URI to controller method

Convention-based and attribute-based routing

Learning About Routing

Trang 10

app.UseMvc(config => {

config.MapRoute(

name: "Default",template: "{controller}/{action}/{id?}",defaults: new { controller="Home", action="Index" }); });

Convention-based Routing

Conventions need to be configured

Not advised for API’s

Trang 12

HTTP Method Attribute Level Sample URI

GET HttpGet Action /api/cities

/api/cities/1 POST HttpPost Action /api/cities

PUT HttpPut Action /api/cities/1

PATCH HttpPatch Action /api/cities/1 DELETE HttpDelete Action /api/cities/1

- Route Controller

-Routing

Trang 15

- What is responsible for a failed request

The Importance of Status Codes

Trang 16

500 – Internal Server Error

Trang 20

Media type is passed via the Accept header

Trang 21

Output formatter

Deals with output

Media type: accept header

Trang 23

This bullet list

with

animations

Model-View-Controller

- Model: application data logic

- View: display data

- Controller: interaction between View and Model

- More reuse, better testabilityRouting: maps URI to controller method

Summary

Trang 24

This bullet list

with

animations

Content negotiation: selecting the best representation for a given response

- Output formatters (accept header)

- Input formatters (content-type header)

Summary

Ngày đăng: 17/11/2019, 08:26

TỪ KHÓA LIÊN QUAN