Getting Started

Installation guide for Node.js development with TDPnet

Creating apps with Node.js

Creating a development environment is a crucial step in starting any software project. A well-configured environment ensures that your code runs smoothly and consistently across different machines and setups. In this guide, we'll walk you through setting up a basic development environment using a "Hello World" service provider example.

By the end of this guide, you will have cloned a repository, navigated to the appropriate folder, installed the necessary dependencies, and reviewed the project's README file for additional instructions and information.

Step 1: Install Node.js

The first step in setting up your development environment is to install Node.js. Go to the Node.js official website at:

Step 2: Install a Text Editor and Create a Project Directory

Before cloning the repository, you'll need a text editor to work with your code. We recommend Visual Studio Code, a free and powerful code editor.

Download and install Visual Studio Code from:

Next, create a directory on your local machine where you want to store your project files. You can create it anywhere you prefer. For example:

C:/new-project

Once you've created the directory, open Visual Studio Code and navigate to this folder using File → Open Folder, or use the terminal within VS Code to navigate to your newly created directory.

Step 3: Clone the repository

A repository is essentially a storage space where your project's files and history are kept. For cloning the repository that contains the project files, open your text editor's terminal and run the following command:

git clone https://github.com/riemaxi/tdplayground.git

Step 4: Navigate to the node folder

After cloning the repository, you need to navigate to the specific folder in the programming language you choose. In this particular case, you need to navigate to the node folder.

cd tdplayground/getstarted/node

Changing the directory to the node folder puts you in the right location to run commands and scripts specific to the "Hello World" service provider example.

Step 5: Install Dependencies

Most projects, especially those involving Node.js, require additional packages or libraries to run correctly. These packages are called dependencies. Installing them is essential before you can start developing or running the project.

While still in the node folder, run the following command:

npm install

Step 6: Get your credentials

Remember that you are at the folder node. In order to get your credentials, you need to run the following command. It's a good practice to read the README file associated with the project as well.

node randomkey.js

You will get your credentials for logging into TDPnet. The credentials will appear in the following format:

credentials: {
  accesskey: 'XXXX56',
  password: 'XXXXXXXX-XXXX-XXXX-XXXX-4ec619ffc50d',
  address: 'use your own address or leave it empty'
}

Step 7: Replace the entry credentials in config.js

Go to the directory helloworld-ps, if you are creating a Service Provider or to helloworld-braket, if you want to change the page's appearance. Change the credentials in the configuration file config.js.

The configuration file for the example helloworld-ps is located at:

cd tdplayground/getstarted/node/helloworld-sp/config.js

The configuration file for the example helloworld-braket is located at:

cd tdplayground/getstarted/node/helloworld-braket/config.js

Step 8: Try out the interface

Once you have edited the configuration file, navigate to the directory helloworld-sp or helloworld-braket and run the following command:

node index.js

If you get the following response, it means you have properly set up the development environment:

granted to hello.from.somebody
greeter.getstarted.tdpnet.4da 1725452766173 hello world!
greeter.getstarted.tdpnet.4da 1725452766202 hello world!
greeter.getstarted.tdpnet.4da 1725452766230 hello world!
greeter.getstarted.tdpnet.4da 1725452766260 hello world!
greeter.getstarted.tdpnet.4da 1725452766285 hello world!
greeter.getstarted.tdpnet.4da 1725452766308 hello world!
greeter.getstarted.tdpnet.4da 1725452766331 hello world!
greeter.getstarted.tdpnet.4da 1725452766355 hello world!
greeter.getstarted.tdpnet.4da 1725452766379 hello world!
greeter.getstarted.tdpnet.4da 1725452766404 hello world!
greeter.getstarted.tdpnet.4da 1725452766428 hello world!
greeter.getstarted.tdpnet.4da 1725452766452 hello world!
greeter.getstarted.tdpnet.4da 1725452766476 hello world!
greeter.getstarted.tdpnet.4da 1725452766500 hello world!
greeter.getstarted.tdpnet.4da 1725452766524 hello world!
greeter.getstarted.tdpnet.4da 1725452766547 hello world!

Now you can stop receiving responses by typing Ctrl + C, for instance, in Visual Studio Code text editor and start creating your own service provider.

Conclusion

By following these steps, you've successfully set up a basic development environment based on the "Hello World" service provider example. You now have a local copy of the project, all necessary dependencies installed, and an understanding of where to find further information. This setup will serve as a foundation as you continue to develop and expand on the project.