diff --git a/docs/developer-docs/web-apps/application-frontends/default-frontend.mdx b/docs/developer-docs/web-apps/application-frontends/default-frontend.mdx index 5b23117955..dc96f9da32 100644 --- a/docs/developer-docs/web-apps/application-frontends/default-frontend.mdx +++ b/docs/developer-docs/web-apps/application-frontends/default-frontend.mdx @@ -35,7 +35,17 @@ When a dapp is deployed to ICP and has a frontend configured, the frontend asset For canisters deployed to the mainnet, the canister can be accessed in a web browser using the canister's ID followed by `.ic0.app`, `.icp0.io` or `raw.icp0.io`. For example, the [playground](https://m7sm4-2iaaa-aaaab-qabra-cai.ic0.app/) is an application with a frontend user interface that can be used to deploy canisters in a temporary, sandbox environment. This dapp can be accessed via the URL `https://m7sm4-2iaaa-aaaab-qabra-cai.ic0.app/`. -The `raw.icp0.io` domain is used for canisters deployed to the mainnet, and provides a way to access the raw HTTP interface of that canister. For local deployments that want to simulate the behavior of the `raw.icp0.io` domain, you must implement a method in your canister that consumes an HTTP request and outputs an HTTP response. +The `raw.icp0.io` domain is used for canisters deployed to the mainnet, and provides a way to access the raw HTTP interface of that canister. For local deployments that want to simulate the behavior of the `raw.icp0.io` domain, you must implement a method in your canister that consumes an HTTP request and outputs an HTTP response. Here is an example written in Motoko: + +```motoko no-repl +public shared(msg) func http_request(req: HttpRequest) : async HttpResponse { + { + status = { code = 200; reason = "OK" }; + headers = [( "Content-Type", "text/plain" )]; + body = Text.encodeUtf8("Hello, World!"); + } +}; +``` By default, projects created with `dfx new` have the option to include a frontend canister that uses a template for one of several frontend frameworks. This guide illustrates using the default React template generated by `dfx new` and guides you through some basic modifications to customize the interface displayed.