Skip to content

Latest commit

 

History

History
54 lines (45 loc) · 1.59 KB

README.md

File metadata and controls

54 lines (45 loc) · 1.59 KB

Fibonacci WAGI Module

This example exposes a simple fibonacci WAGI function written in assembly script as a route endpoint in ASP.Net Core.

Clone the repo, switch to the examples/fibonacci folder and then run:

dotnet run

This starts a ASP.Net Core Web application WAGI host on port 8888.

Use a browser or a tool like curl to test:

$ curl -v http://localhost:8888/fibonacci?93
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8888 (#0)
> GET /fibonacci?93 HTTP/1.1
> Host: localhost:8888
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Wed, 05 May 2021 10:49:29 GMT
< Content-Type: text/plain
< Server: Kestrel
< Transfer-Encoding: chunked
<
fib(93)=12200160415121876738
* Connection #0 to host localhost left intact

The configuration for this is example can be found in the appsettings.Development.json configuration file:

  // The name of the configuration section for the WAGI route handler, by default this is expected to be called Wagi.
  "Wagi": {
    // The relative path to the directory where WAGI modules defined in this configuration section are located.
    "ModulePath": "modules",
    // A dictionary of one or more modules to be exposed by the application
    "Modules": {
       // The logical name of the module definition
      "fibonacci": {
        // The file name of the module.
        "FileName": "fibonacci.wasm",
        // Route that is appended to the url of the server to form the URL to access the module
        "Route" : "/fibonacci"
      }
    }
  }