Working Locally
The Code Hub can be used entirely from the command line using the CLI if you'd rather use your own tools to work locally.
Code Hub can also be used in the cloud using a Visual Studio Code workspace - see our guide on working in the cloud for more information.
CLI Installation
Code Hub can be used entirely from the command-line; vcr is the command-line interface that is required for managing and deploying your applications from the terminal.
Configure the CLI
Configure your account using this command:
The command will ask for your a default region as well as your Vonage API key and secret which you can get from the from the API Dashboard.
Updating the CLI
To update the CLI run:
This will print out the current version of the CLI you have installed. If there is a newer version available, you will be prompted to install it.
NOTE: You may need to run the command using sudo to give the Cloud Runtime CLI permissions to move the new CLI version into the installation folder. You can also perform the move yourself.
Using the CLI
To initialize a project, run the following command to start inputting your details:
Running the command will prompt you for the following information:
- Project name: a name for your project.
- Instance Name: Enter a name for the instance that will be created. You can have multiple instances for a single project, so this should be memorable.
- Runtime: Select the runtime you want to use when the code is executed.
- Region: Select the region you want your instance to run in.
- Application ID for Instance: In order to use the Vonage APIs, an Application is required. Select the Application ID for the application you wish to use; if you haven't created one yet, you can skip this step and enter the ID later. To create an application, go to the Applications page on the Vonage dashboard or run
vcr app create. When you deploy your instance, Cloud Runtime will automatically configure the webhooks on your application for you. - Application ID for Debug: You can supply a separate Application ID to be used only for debugging, meaning that your deployed instance and corresponding Application and webhooks will not be affected by local debugging.
- Template: Choose a template from the list to view an existing project. A full list of templates can be found in the Code Hub
Once you have entered all of the necessary information a vcr.yaml config file will be created, where you can add anything you skipped, or edit any of the details you just provided. If you have selected a template, the files required for running that application will also be downloaded. You can now open those files in your local setup to begin viewing and editing the project.
Next Steps
When you are working on your project, you may find the following resources useful: