RDCore.Web
Ce document est disponible en français

V I V A T ❤️ C U C U M I S ™
Note
RDCore.Web is an alpha prerelease (v0.1.0-alpha). Its host serves the endpoints of a composed program: see What works.
What it is
RDCore.Web is the web framework of RDCore. It serves the procedures of an RD-VBA project's modules as HTTP endpoints, through ASP.NET Core. Rubberduck comment annotations declare them: '@Controller on the module, '@HttpGet and '@HttpPost on its procedures. A procedure's arguments and value pass as JSON, so the frontend can be any app that sends HTTP requests, such as a Node.js or React app.
'@Controller("api")
Option Explicit
'@HttpGet("hello/{name}")
Public Function Hello(ByVal name As Variant) As Variant
Dim greeting As Object
Set greeting = CreateObject("Scripting.Dictionary")
greeting.Add "greeting", "Hello, " & name & "!"
Set Hello = greeting
End Function
Hello is the endpoint GET /api/hello/{name}. The annotations are comments to VBA, so the module compiles in VBA as it is.
What works
| Part | Status |
|---|---|
Endpoints from '@Controller and the HTTP method annotations: '@HttpGet, '@HttpPost, '@HttpPut, '@HttpPatch, '@HttpDelete, '@HttpHead and '@HttpOptions, each with the route under the controller's |
Works: read from a module's parse. |
Binding: route values and query string values into the parameters of their names; the JSON body of a POST, a PUT or a PATCH into the parameter '@FromBody names, else the first one its route does not bind, and of a DELETE into the parameter '@FromBody names only |
Works. |
Responses: the procedure's value as JSON (200), no value (204), a run-time error as 500 with problem details, and the results of RDWeb.Results, such as Status(404, "No order 7.") |
Works. |
| A pool of machines, each running one request at a time: it grows to its maximum, resets each machine after each request, and recycles a machine after a set number of requests | Works. |
Kept machines: a machine for each key of a controller with '@KeptMachine, made by '@NewMachine and never reset between its requests |
Works. |
Services and startup: Program.Run, '@Service classes, the factories of controllers with a default instance, and filters |
Works. |
JSON values: objects of the workspace's classes, typed arrays and Collection, and the RDJson library for VBA code |
Works, in an endpoint's arguments and value, and in VBA code. |
The OpenAPI document at /openapi/v1.json, and its Swagger UI page at /swagger |
Works, by default in the Development environment. |
The diagnostics RDW00001 to RDW00007, each with its page |
Works in an RDCore platform that loads the RDWeb extension. |
The host: the program of a composition (--RDWeb:Composition), its endpoints, the files of its web root, and the external host of its own machines |
Works. |
Where to go next
| Page | Read it to |
|---|---|
| Overview | See how an annotated class module becomes endpoints, and how RDCore.Web relates to ASP.NET Core and to an Excel or Access project. |
| Getting Started | Build and run the host, write a controller module and call it. |
| Reference | Look up each part's syntax and rules (English only). |
| Diagnostics | Look up each RDW diagnostic. |
| API | Look up the .NET types that implement them (English only). |
| RDCore.Web repository | Read the source and how to build it. |
ACCUEIL • HOME | APERÇU • OVERVIEW | DÉMARRER • GET STARTED | RDCore | SDK | 🌐 rubberduckvba.ca