|
2 | 2 |
|
3 | 3 | This example demonstrates a counter application. |
4 | 4 |
|
5 | | -## Prerequisites |
6 | | -This example requires an installation of: |
| 5 | +## Deploying from ICP Ninja |
7 | 6 |
|
8 | | -- [x] Install the [IC SDK](https://internetcomputer.org/docs/current/developer-docs/setup/install/). |
9 | | -- [x] Download the following project files from GitHub: `git clone https://github.com/dfinity/examples/` |
| 7 | +[](https://icp.ninja/editor?g=https://github.com/dfinity/examples/tree/master/rust/counter) |
10 | 8 |
|
11 | | -Begin by opening a terminal window. |
| 9 | +## Build and deploy from the command-line |
12 | 10 |
|
13 | | -## Step 1: Setup the project environment |
| 11 | +### 1. [Download and install the IC SDK.](https://internetcomputer.org/docs/building-apps/getting-started/install) |
14 | 12 |
|
15 | | -Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the commands: |
| 13 | +### 2. Download your project from ICP Ninja using the 'Download files' button on the upper left corner, or [clone the GitHub examples repository.](https://github.com/dfinity/examples/) |
16 | 14 |
|
| 15 | +### 3. Navigate into the project's directory. |
17 | 16 |
|
18 | | -```bash |
19 | | -cd examples/rust/counter |
20 | | -dfx start --background |
21 | | -``` |
22 | | - |
23 | | -## Step 2: Test the canister |
| 17 | +### 4. Deploy the project to your local environment: |
24 | 18 |
|
25 | | -```bash |
26 | | -cargo test |
27 | 19 | ``` |
28 | | - |
29 | | -## Step 3: Deploy the canister |
30 | | - |
31 | | -```bash |
32 | | -dfx deploy |
| 20 | +dfx start --background --clean && dfx deploy |
33 | 21 | ``` |
34 | 22 |
|
35 | | -## Step 4: Set the value of the counter |
36 | | - |
37 | | -```bash |
38 | | -dfx canister call counter set '(7)' |
39 | | -``` |
40 | | - |
41 | | -## Step 5: Increment the value of the counter |
42 | | - |
43 | | -```bash |
44 | | -dfx canister call counter inc |
45 | | -``` |
46 | | - |
47 | | -## Step 6: Get the value of the counter |
48 | | - |
49 | | -```bash |
50 | | -dfx canister call counter get |
51 | | -``` |
52 | | - |
53 | | -The following output should be returned: |
54 | | - |
55 | | -```bash |
56 | | -(8 : nat) |
57 | | -``` |
58 | | - |
59 | | - |
60 | 23 | ## Security considerations and best practices |
61 | 24 |
|
62 | | -If you base your application on this example, we recommend you familiarize yourself with and adhere to the [security best practices](https://internetcomputer.org/docs/current/references/security/) for developing on the Internet Computer. This example may not implement all the best practices. |
| 25 | +If you base your application on this example, it is recommended that you familiarize yourself with and adhere to the [security best practices](https://internetcomputer.org/docs/building-apps/security/overview) for developing on ICP. This example may not implement all the best practices. |
63 | 26 |
|
0 commit comments