Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Modern WebAPIS with ASP.NET Core
Search
Fabian Gosebrink
June 25, 2018
Technology
1
120
Modern WebAPIS with ASP.NET Core
Slides for my talk at the DWX 2018 in Nürnberg "Modern WebAPIs with ASP.NET Core"
Fabian Gosebrink
June 25, 2018
Tweet
Share
More Decks by Fabian Gosebrink
See All by Fabian Gosebrink
Why State is the Most Important Part of Your Angular Application
fabiangosebrink
0
47
Angular testing made easy with Jest and Cypress
fabiangosebrink
0
78
Introducing state management into an application with NgRx
fabiangosebrink
0
120
Scalable architectures in Angular with Nx
fabiangosebrink
0
100
My Biggest Angular Mistakes and How To Avoid Them
fabiangosebrink
0
210
[iJS Munich] Better Angular Architectures with Libraries and Nx
fabiangosebrink
0
130
Mastering State Management in Angular with the NgRx Signal Store
fabiangosebrink
0
320
Angular Architectures with NgRx Stores & Effects
fabiangosebrink
0
97
Angular Testing made easy with Jest and Cypress
fabiangosebrink
0
97
Other Decks in Technology
See All in Technology
オフィスビルを監視しよう:フィジカル×デジタルにまたがるSLI/SLO設計と運用の難しさ / Monitoring Office Buildings: The Challenge of Physical-Digital SLI/SLO Design & Operation
bitkey
1
350
QuickSight SPICE の効果的な運用戦略~S3 + Athena 構成での実践ノウハウ~/quicksight-spice-s3-athena-best-practices
emiki
0
260
Zero Data Loss Autonomous Recovery Service サービス概要
oracle4engineer
PRO
2
7.8k
VS CodeとGitHub Copilotで爆速開発!アップデートの波に乗るおさらい会 / Rapid Development with VS Code and GitHub Copilot: Catch the Latest Wave
yamachu
2
340
助けて! XからWaylandに移行しないと新しいGNOMEが使えなくなっちゃう 2025-07-12
nobutomurata
2
140
ビジネス職が分析も担う事業部制組織でのデータ活用の仕組みづくり / Enabling Data Analytics in Business-Led Divisional Organizations
zaimy
1
310
IPA&AWSダブル全冠が明かす、人生を変えた勉強法のすべて
iwamot
PRO
2
220
衛星運用をソフトウェアエンジニアに依頼したときにできあがるもの
sankichi92
1
230
20250707-AI活用の個人差を埋めるチームづくり
shnjtk
6
4.1k
大量配信システムにおけるSLOの実践:「見えない」信頼性をSLOで可視化
plaidtech
PRO
0
290
敢えて生成AIを使わないマネジメント業務
kzkmaeda
2
510
オーティファイ会社紹介資料 / Autify Company Deck
autifyhq
10
130k
Featured
See All Featured
Side Projects
sachag
455
42k
A better future with KSS
kneath
238
17k
Raft: Consensus for Rubyists
vanstee
140
7k
Adopting Sorbet at Scale
ufuk
77
9.5k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.3k
Done Done
chrislema
184
16k
Why You Should Never Use an ORM
jnunemaker
PRO
58
9.4k
Documentation Writing (for coders)
carmenintech
72
4.9k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
5.9k
It's Worth the Effort
3n
185
28k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
Transcript
with Building modern WebAPIs ASP.NET Core
None
None
None
@FabianGosebrink
None
https://developer-academy.ch
with Building modern WebAPIs ASP.NET Core
What is ASP.NET Core?
MVC + WebAPI + Web Pages
None
Faster Deployment Cycles
None
Tooling
DOTNET CLI fabian gosebrink
class Program { static void Main(string[] args) { Console.WriteLine("Hello World!");
} }
DOTNET CLI fabian gosebrink
Program.cs 1. public class Program 2. { 3. public static
void Main(string[] args) 4. { 5. CreateWebHostBuilder(args).Build().Run(); 6. } 7. 8. public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 9. WebHost.CreateDefaultBuilder(args) 10. .UseStartup<Startup>(); 11. }
public static IWebHostBuilder CreateDefaultBuilder(string[] args) { var builder = new
WebHostBuilder(); builder.UseKestrel(...) .ConfigureAppConfiguration((hostingContext, config) => { config.AddJsonFile( "appsettings.json", optional: true, reloadOnChange: true); }) .ConfigureLogging((hostingContext, logging) => { logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); logging.AddConsole(); logging.AddDebug(); }) .ConfigureServices((hostingContext, services) => { //... }) .UseIISIntegration(); return builder; }
Dependency Injection
Startup.cs 1. public class Startup 2. { 3. public Startup(IConfiguration
configuration) 4. { 5. Configuration = configuration; 6. } 7. 8. public IConfiguration Configuration { get; } 9. 10. public void ConfigureServices(IServiceCollection services) 11. { 12. services.AddOptions(); 13. 14. services.AddCors(...); 15.
Kestrel
None
REST
What is Rest?
Rest is not WebAPI
Rest is not HTTP
None
Architectural Style
GET /api/orders/ GET /api/orders/1 POST /api/orders/ PUT /api/orders/1 DELETE /api/orders/1
Rest Constraints
Richardson Maturity Model
STATUSCODES
export const isSuccess = (status): boolean => (status >= 200
&& status < 300)
2xx
4xx
5xx
The Controller 1. [Route("api/[controller]")] 2. public class FoodController : Controller
3. { 4. private readonly IFoodRepository _foodRepository; 5. 6. public FoodController(IFoodRepository foodRepository) 7. { 8. _foodRepository = foodRepository; 9. } 10. 11. [HttpGet] 12. public ActionResult<List<FoodItemDto>> Get() 13. { 14. ICollection<FoodItem> foodItems = _foodRepository.GetAll(); 15. IEnumerable<FoodItemDto> dtos = foodItems 16. .Select(x => Mapper.Map<FoodItemDto>(x)); 17. 18. return Ok(dtos);
Documentation
Documentation
None
VERSIONING
document.docx
document- nal.docx
document- nal- nal.docx
document-really- nal.docx
document-really- nal-end- of-discussion.docx
document-really- nal- approved-by- customer.docx
document-really- nal- approved-by-customer- with-alterations- suggested-by-his- assistant.docx
document-really- nal-approved- by-customer-with-alterations- suggested-by-his-assistant-and- his-friend-cause-apparently-he- thinks-he-knows-all-about-good- api-design
document-really- nal-approved- by-customer-with-alterations- suggested-by-his-assistant-and- his-friend-cause-apparently-he- thinks-he-knows-all-about-good- api-design.docx
None
None
DEMO
/api/houses?page=4&pageSize=10
/api/houses?orderby=Id
/api/houses?fields=street,number
HATEOAS
{ "departmentId": 10, "departmentName": "Administration", "locationId": 1700, "managerId": 200, "links":
[ { "href": "10/employees", "rel": "employees", "type" : "GET" } ] }
SignalR
None
None
None
Le Fin
@FabianGosebrink https://offering.solutions/
[email protected]
https://github.com/FabianGosebrink https://github.com/FabianGosebrink/ASPNETCore- WebAPI-Sample
Resources https://media.giphy.com/media/1BXa2alBjrCXC/giphy.gif http://img0.joyreactor.com/pics/post/photo-india-it-programmer-548432.jpeg