Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mehr als nur HTTP-APIs: Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions

Mehr als nur HTTP-APIs: Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions

Serverless ist in aller Munde und so gut wie jede JavaScript-basierte Anwendung braucht irgendeine Art von Backend. Warum also nicht die beiden Ideen vereinen? In dieser Session zeigt Christian anhand von Azure Functions, wie man mit TypeScript effizient eigene HTTP APIs baut, ohne großes Infrastruktur-Tamtam.
Aber damit nicht genug: Basierend auf allgemein anerkannten Prinzipien können wir serverlose Architekturen und Technologien verwenden, um hochfokussierte Microservices zu erstellen. Sieh dafür einen pragmatischen Ansatz mit Functions, Service Bus und weiteren Azure-Cloud-Diensten sowie Tools. Eben mehr als nur HTTP-APIs.

Christian Weyer

June 27, 2019
Tweet

More Decks by Christian Weyer

Other Decks in Programming

Transcript

  1. Mehr als nur HTTP-APIs: Pragmatische Serverless Backends mit JavaScript /

    TypeScript und Azure Functions Christian Weyer @christianweyer CTO
  2. 2 § Founder & CTO at Thinktecture AG § Personal

    focus on § Mobile & web-based application architectures § Interoperability, cross-device § Pragmatic end-to-end solutions § Cloud-native & serverless architectures § Independent Microsoft Regional Director § Microsoft MVP for ASP.NET (Architecture) ASPInsider, AzureInsider § Google GDE for Web Technologies [email protected] @christianweyer https://www.thinktecture.com Christian Weyer Mehr als nur HTTP-APIs Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions
  3. 3 § Architectures for SPAs § HTTPS APIs § Microservices

    § Serverless § Recurring Jobs § Decoupled Services Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions Mehr als nur HTTP-APIs Our Journey Today
  4. End-to-end solutions Architectures for SPAs Mehr als nur HTTP-APIs Pragmatische

    Serverless Backends mit JavaScript / TypeScript und Azure Functions 4
  5. 5 Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure

    Functions Mehr als nur HTTP-APIs Services Backend (kind of) - Monoliths
  6. Classic synchronous system boundaries HTTPS APIs Mehr als nur HTTP-APIs

    Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions 6
  7. 7 Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure

    Functions Mehr als nur HTTP-APIs HTTPS APIs – RPC, REST, OData, GraphQL [maybe WebSockets] R P C R E S T G Q L HTTPS HTTPS HTTPS WebSocket
  8. Focusing on the ‘right’ thing Microservices Mehr als nur HTTP-APIs

    Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions 8
  9. 9 Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure

    Functions Mehr als nur HTTP-APIs Microservices – dedicated & decoupled R P C R E S T G Q L HTTPS HTTPS HTTPS WebSocket
  10. A different approach Serverless Mehr als nur HTTP-APIs Pragmatische Serverless

    Backends mit JavaScript / TypeScript und Azure Functions 10
  11. 11 Serverless Programming Model Functions-as-a-Service (FaaS) § Event-driven § Stateless

    § Service-ful Operational Model § Fully managed § Automatically scaling § Usage priced Mehr als nur HTTP-APIs Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions → Feature-ful → Productivity-ful
  12. 12 § Code being triggered by an event § Cost-optimized,

    automatic scaling runtime environment § Available for self-hosting § Local tooling & runtime § Multiple language bindings supported § C# ▪ Powershell (experimental) § JS, TS ▪ Python (experimental) § F# § Java Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions Mehr als nur HTTP-APIs Serverless Functions-as-a-Service – with Azure Functions
  13. 13 § Incoming event triggers function § Input bindings §

    easy access to data from various data sources § Output bindings § easy access to outbound data sinks § Out-of-box bindings § https://docs.microsoft.com/en-us/ azure/azure-functions/functions- triggers-bindings #supported-bindings Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions Mehr als nur HTTP-APIs Azure Functions Triggers & Bindings Your code logic Runtime Azure Function HTTP Trigger Storage Input Binding Push Notification Output Binding Database Output Binding Email Output Binding Example
  14. More than HTTP APIs - I Recurring Jobs Mehr als

    nur HTTP-APIs Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions 14
  15. 15 § Execute code based on a schedule § Timer

    Triggers use CRON expressions Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions Mehr als nur HTTP-APIs Background Services - with Azure Functions Timer Triggers Your code logic Runtime Azure Function Timer Trigger Storage Input Binding Database Output Binding Expression Description 0 * * * * * every minute 0 */5 * * * * every 5 minutes 0 0 * * * * every hour (hourly) 0 0 */6 * * * every 6 hours 0 0 8-18 * * * every hour between 8-18 0 0 10 * * * every day at 10:00:00 0 0 * * * 1-5 every hour on workdays 0 0 0 * * 0 every Sunday (weekly) 0 0 9 * * MON every Monday at 09:00:00 0 0 0 1 * * every 1st of month (monthly) 0 0 0 1 1 * every 1st of january (yearly) 0 0 0 * * SAT,SUN every Saturday and Sunday
  16. More than HTTP APIs - II Async Business Processes Mehr

    als nur HTTP-APIs Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions 16
  17. 17 Sender § Offers Queues and Topics & Subscriptions §

    Standards-based with AMQP 1.0 § Queues § Sender sends message to queue § Queue ACKs receipt § Receiver connects to queue & retrieves message § Receiver ACKs complete (or other action) Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions Mehr als nur HTTP-APIs Decoupling Services - with Azure Service Bus Queues Receiver
  18. Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions

    Mehr als nur HTTP-APIs Sample Architecture – Shopping Order Monitoring Orders Service Products Service Shipping Service AuthN Service Order Monitoring SPA Shopping Web Site (simulated by Postman ) 1 - authenticate 2 - register for push 3 - send new order 5 - new order created push 6 - get updated orders 4 - processing order… 18
  19. Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions

    Mehr als nur HTTP-APIs Sample Architecture – Shopping Order Monitoring: Serverless Orders Service Products Service Shipping Service AuthN Service Order Monitoring SPA Shopping Web Site (simulated by Postman) Azure Function App – C# Azure Function App - C# Azure Function App - JS Azure Function App - Java Azure Service Bus Azure Blob Storage Azure SignalR Service Azure Table Storage Azure Cosmos DB Identity Server 19
  20. Summary Serverless is the future … but beware of the

    pitfalls of Microservices❗ Mehr als nur HTTP-APIs Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions 20
  21. 21 Remember: there are NO servers! https://twitter.com/jeffhollan/status/1030244102082682880 Mehr als nur

    HTTP-APIs Pragmatische Serverless Backends mit JavaScript / TypeScript und Azure Functions