Every now and then someone asks whether Motoko canisters can use certified variables, or whether they can serve HTTP requests with certification, and I always responded that yes, Motoko can do that, all that’s missing are a few libraries. But I figured I should put my hand where my mouth is, and actually demonstrate that it’s possible.
So here we go. If you go to https://ce7vw-haaaa-aaaai-aanva-cai.ic0.app/ you will see that
- the URL has no
rawin it, so it is certified,
- that the response is actually dynamic; you can leave a message at the bottom of Principal ce7vw-haaaa-aaaai-aanva-cai | ic.rocks and see it show up
- this claims it’s written in Motoko.
To prove the latter claim, here is the commented code; you can also browse the full repository.
Actually, the code is not here, because of this annoying 403 bug of the forum where after carefully editing and formatting the post, it says I can’t post it. Too many URLs maybe? So unfortunately, you’ll have to go to https://gist.github.com/nomeata/f325fcd2a6692df06e38adedf9ca1877 to read it.