Geal/serverless-wasm

demo

Opened this issue · 0 comments

Geal commented

with the current working version (as of commit f0e2f3e), here is how we can demonstrate the system:

  • compile the program by running cargo build (needs rust installed)
  • start the server with the configuration file: ./target/debug/serverless-wasm ./samples/config.toml
    • the configuration file maps some HTTP requests (like GET /hello) to specific functions in wasm files (samples/testfunc.wasm and samples/testbackend.wasm). The wasm files are already compiled and committed to the repository
  • do a first request with:
    • curl http://127.0.0.1:8080/hello: the server will answer Hello world from wasm!
    • curl http://127.0.0.1:8080/bonjour: the server will answer Bonjour tout le monde depuis le monde merveilleux de WASM!
    • those to endpoints are served by the testfunc project, containing two functions that build a HTTP response and send it
  • start a tcp listener on 127.0.0.1:8181 like this: nc -l -p 8181 (the port can be changed in the configuration file)
    • call the server on the remaining endpoint, served by testbackend:
      • curl http://127.0.0.1:8080/backend
      • the netcat listener will see a hello
      • if you type anything in the netcat shell and "enter", the text will be sent back as response to the client