In this codeLab you will learn how to use the Motoko Result type to handle success and errors cases in a dictionary application.
mkdir myapp && cd myapp
dfx start --clean
npx degit https://github.com/samlinux-development/codeLab-01.git
npm install
dfx deploy
Use the following function schema to add some words and definitions to the dictionary in terminal 2.
dfx canister call backend addWord '("word", "description")'
dfx canister call backend addWord '("query", "A query is an optimised way to execute operations on a canister where the state changes are not preserved. Queries are synchronous and can be made to any node that hosts the canister. Queries do not require consensus to verify the result.")'
dfx canister call backend addWord '("replica", "The replica is a collection of protocol components that are necessary for a node to participate in a subnet.")'
echo http://$(dfx canister id frontend).localhost:4943
You can serve the frontend in development mode like you normally develop an app using the command. But first, make sure your run dfx deploy to create the .env file and all decalarations.
npm run dev
To test your dApp under the Internet Computer's environment, you can deploy it to the Motoko Playground.
dfx deploy --playground