The tool to upload HTML apps to the DDC
npm install @cere-ddc-sdk/web-loaderThis package allows to upload HTML apps to the DDC.
``shell`
npm i @cere-ddc-sdk/ddc-client @cere-ddc-sdk/web-loader -D
#### A deploy script example:
`javascript
import { uploadWebApp } from '@cere-ddc-sdk/web-loader';
import { DdcClient, TESTNET } from '@cere-ddc-sdk/ddc-client';
const ddcClient = await DdcClient.buildAndConnect(
{
clusterAddress: Number(process.env.CLUSTER_ADDRESS),
smartContract: TESTNET,
},
process.env.USER_MNEMONIC,
);
const result = await uploadWebApp(ddcClient, {
folder: distFolder,
appId: process.env.DDC_APP_ID,
bucketId: process.env.BUCKET_ID,
});
`process.env.USER_MNEMONIC
#### Used variables:
1. , how to set up a userprocess.env.BUCKET_ID
2. is a bucket id, refer to this guide to find out how to create a bucketprocess.env.CLUSTER_ADDRESS
3. can be found hereprocess.env.DDC_APP_ID
4. this appId could be omitted for the first upload, but it will be required if you want to update the already uploaded app. The target app URL will look like . I.e. appId is any unique, within a bucket, string.
#### The script result:
`typescript``
// the script above will return an object
type Result = {
url: string; // an URL for the uploded app
appId: string; // if the appId was omitted, one can use this value for the next updates
}