# Scripting

## Plugin Walkthrough - 'hello-exchange' script.js

So to get started with the *hello-exchange* server script, first we are going to need to make the actual script that will be run:

1. Create a new file called `script.js`, in the same directory as the `config.json` (`plugins/src/plugins/hello-exchange/server/script.js`)
2. Fill this `script.js` with the code found in the box below.

<details>

<summary><em>hello-plugin</em>  <code>script.js</code> code</summary>

{% code lineNumbers="true" %}

```javascript
'use strict';

const { publicMeta, meta } = this.configValues;
const {
	app,
	loggerPlugin,
	toolsLib
} = this.pluginLibraries;
const helloWorld = require('hello-world-npm');
const moment = require('moment');

const init = async () => {
	loggerPlugin.info(
		'HELLO-PLUGIN PLUGIN initializing...'
	);

	if (!meta.private_message.value) {
		throw new Error('Configuration value private required');
	}
};

init()
	.then(() => {
		app.get('/plugins/hello-plugin/info', (req, res) => {
			loggerPlugin.verbose(
				req.uuid,
				'GET /plugins/hello-plugin/info'
			);

			return res.json({
				public_message: publicMeta.public_message.value,
				private_message: meta.private_message.value,
				library_message: helloWorld(),
				moment_timestamp: moment().toISOString(),
				exchange_info: toolsLib.getKitConfig().info
			});
		});
	})
	.catch((err) => {
		loggerPlugin.error(
			'HELLO-PLUGIN PLUGIN error during initialization',
			err.message
		);
	});
```

{% endcode %}

</details>

Check the screenshot below to compare and make sure you have the file in the correct location.&#x20;

<figure><img src="/files/ZYSHCpsG1sBYl9ebBQ9I" alt=""><figcaption></figcaption></figure>

## Calling the End Point

Now we have constructed '*hello-plugin*', let's call the endpoint. First, we will need to build the plugin.

1. If the terminals from earlier (when following how to set up dev mode) are no longer up, lets first get them going.&#x20;
   1. In one terminal navigate to *hollaex-kit/server* and run `docker-compose up`
   2. In the other,  enter the docker container with:  `docker exec -it server_hollaex-kit-server_1 /bin/bash`
2. With both the containers running build the plugin by running: `node plugins/dev.js --plugin=hello-plugin` inside the container (terminal we ran 'docker exec...' in)

Great news! This is all we had to do, and can now have a look at the plugin in the browser through the following URL:

<http://localhost:10013/plugins/hello-plugin/info>

You should see an output similar to below:

<figure><img src="/files/P9Yb46SCaz6fkRA9OVZ1" alt=""><figcaption><p>Chrome</p></figcaption></figure>

<figure><img src="/files/1LG8qIklAovfAvrL1icl" alt=""><figcaption><p>Firefox</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hollaex.com/plugins/develop-plugins/development-walkthrough-hello-plugin/scripting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
