Skip to content

Commit

Permalink
Merge pull request #3552 from dfinity/raw-icp0-example
Browse files Browse the repository at this point in the history
add: `raw.icp0` local example
  • Loading branch information
jessiemongeon1 authored Sep 30, 2024
2 parents bb366f0 + 9260d77 commit 8db3396
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 8db3396

Please sign in to comment.