TypeScript Template
This is a template for TypeScript Cartesi DApps. It uses node to execute the backend application. The application entrypoint is the src/index.ts
file. It is bundled with esbuild, but any bundler can be used.
How it Works
The entrypoint src/index.ts
contains example code that shows all to perfrom CRUD and wallet operations using different custom routes.
The src/examples
directory contains an example greetings.ts
and a route.ts
file.
The greetings.ts
contains classes and methods required to handle the greetings functionality.
The route.ts
manages the different routes required for the greetings.
Prerequisite
Ensure you have the following packages installed
How to Run the Backend Server Using Cartesi CLI
To set up your backend here are the required steps:
Navigate to the backend directory of your created project and run the below command, ensure that your docker is all setup and running.
Install all required dependencies using either
yarn install
ornpm i
!NOTE
To build and run the backend ensure that you have Cartesi CLI is installed and that your docker is up and running.
To build the backend run the below command;
This will build th image. Once this is successful. The next command to run will be
This will start the local server.
The above command will start the local server with the epoch argument set to 5 seconds. You can set it to any number depending on the duration you want to wait before voucher can be executed.
To get list of addresses used for development purpose run this command;
How to Run the Backend Server Using Nonodo
Start nonodo
Start the backend
Success build output:
Success Run Output
To Learn More
To learn more about building on Cartesi you can visit the Cartesi and Sunodu documentations.
Last updated