workflow slide added

This commit is contained in:
thomashamburg 2025-11-12 11:58:50 +01:00
parent ce1f5cb1d9
commit c1f6099fb2

View File

@ -123,13 +123,13 @@ transition: fade-out
### Finding my combination of web technologies for a minimal viable web application. ### Finding my combination of web technologies for a minimal viable web application.
<div class="mt-20"/> <div class="mt-10"/>
- Part 1: The Database: SQLite - Part 1: The Database: SQLite
- Part 2: The No-ORM ORM - A very simple Data Abstraction Layer. - Part 2: The No-ORM ORM - A very simple Data Abstraction Layer.
- Part 3: Developing a Web Server Application in Go. - Part 3: Developing a Web Server Application in Go.
- Part 4: Datastar - a lightweight framework for real-time collaborative web apps. - Part 4: Datastar - a lightweight framework for real-time collaborative web apps.
- Part 5: Modern CSS. - Part 5: Modern HTML and modern CSS.
- Part 6: Web components. - Part 6: Web components.
- Part 7: Simple Deployments with a VPS, Nginx, Certbot and a single binary file. - Part 7: Simple Deployments with a VPS, Nginx, Certbot and a single binary file.
@ -226,7 +226,7 @@ Declarative vs. Imperative, DS conforms strictly to the web's specs.
class: default class: default
--- ---
# Reducing the Network to a Remote Procedure Call # Reducing the Network to a Function Call
```js ```js
{ {
@ -355,37 +355,50 @@ sequenceDiagram
Note over Browser,Backend: Real-time updates without new requests Note over Browser,Backend: Real-time updates without new requests
``` ```
--- ---
class: default layout: two-cols
layoutClass: gap-2
--- ---
# Reducing the Network to a Remote Procedure Call ```mermaid { scale: 0.4}
graph TD
Start([Client Starts]) --> GetProducts[GET /products]
GetProducts --> ProductResp["Response: Product List<br/>links:<br/>add-to-cart: /cart/items<br/>self: /products"]
ProductResp --> AddCart[POST /cart/items]
AddCart --> CartResp["Response: Cart Updated<br/>links:<br/>self: /cart<br/>update-item: /cart/items/id<br/>remove-item: /cart/items/id<br/>checkout: /checkout"]
CartResp --> Decision1{Client Action}
Decision1 -->|Continue Shopping| GetProducts
Decision1 -->|Proceed| Checkout[POST /checkout]
Checkout --> CheckoutResp["Response: Checkout Session<br/>links:<br/>payment: /payment<br/>cancel: /cart"]
```js
{ ```
const { data, error } = await to(fetch("https://api.example.com/api/board")); ::right::
if (error) { ```mermaid { scale: 0.4}
// handle error graph TD
return; CheckoutResp["Response: Checkout Session<br/>links:<br/>payment: /payment<br/>cancel: /cart"] --> Payment[POST /payment]
}
// handle data Payment --> PaymentResp["Response: Payment Success<br/>links:<br/>order: /orders/id<br/>track: /orders/id/tracking<br/>invoice: /orders/id/invoice"]
}
{ PaymentResp --> GetOrder[GET /orders/id]
const { data, error } = await to(fetch("https://api.example.com/api/users/12"));
if (error) { GetOrder --> OrderState{Order State}
// handle error
return; OrderState -->|Pending| PendingResp["Response: Order Pending<br/>links:<br/>self: /orders/id<br/>cancel: /orders/id/cancel<br/>track: /orders/id/tracking"]
}
// handle data OrderState -->|Shipped| ShippedResp["Response: Order Shipped<br/>links:<br/>self: /orders/id<br/>track: /orders/id/tracking<br/>return: /orders/id/return"]
}
OrderState -->|Delivered| DeliveredResp["Response: Order Delivered<br/>links:<br/>self: /orders/id<br/>return: /orders/id/return<br/>review: /orders/id/review"]
// the function that "unwraps" the promise:
export function to(promise: Promise<Response>) { PendingResp --> End([Workflow Complete])
return promise ShippedResp --> End
.then((response) => response.json()) DeliveredResp --> End
.then((data) => ({ data, error: null }))
.catch((error) => ({ data: null, error }));
}
``` ```
--- ---