Created
May 8, 2021 04:44
-
-
Save SuddenlyHazel/26613b42974b88dade60a9db6265fe32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Blob "mo:base/Blob"; | |
import Debug "mo:base/Debug"; | |
import Text "mo:base/Text"; | |
actor { | |
type HeaderField = (Text, Text); | |
type HttpRequest = { | |
method: Text; | |
url: Text; | |
headers: [HeaderField]; | |
body: Blob; | |
}; | |
type HttpResponse = { | |
status_code: Nat16; | |
headers: [HeaderField]; | |
body: Blob; | |
}; | |
public query func http_request(request : HttpRequest) : async HttpResponse { | |
Debug.print("Woah, it works!!"); | |
return { | |
status_code = 200; | |
headers = [("Content-Type", "text/html")]; | |
body = Text.encodeUtf8("<b>Hello World!</b>"); | |
}; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment