Testing Endpoints

Testing Endpoints

You can test the IRS endpoints either using a graphical interface or by running the server locally and testing the endpoints using the terminal.

Test from Terminal

You can run the server locally to test the endpoints from their REST endpoints.

Before you can do this, you will need to first compile the TypeScript code.

Compile the TypeScript code. You can modify .swcrc to change the SWC configurations and package.json to adjust the build command.

npm run build

Or

pnpm build

Then, start the server:

npm run start

Or

pnpm start

Depending on which endpoint you wish to test, and where and on which port your server starts, you should be able to access the IRS endpoints through the terminal using the curl command. The below given example sends the query to the irs endpoint:

curl -X POST "http://127.0.0.1:3400/irs" -H "Content-Type: application/json" -H "Authorization: a5zwhp0YlcRVkpnOXchIkL1lrmf0MPg24POM0kO6HcM=" -d '{"data": { "query": "add 4 litres milk?", "uid": "DI2UZuaTWjQPzVCRjzPW" } }'

Test Using Genkit Developer UI

You can run the Genkit developer UI to test the endpoints. Testing the endpoints using a graphical interface is probably the easiest way to get started. You can know more about the Genkit Developer UI here (opens in a new tab).

Start the Genkit developer UI:

npx genkit start

OR, you can install the Genkit CLI globally:

npm i -g genkit

Then start the Genkit developer UI:

genkit start

You should be able to see your defined IRS endpoints under the Flows section in the left sidebar. Simply click on the endpoint you want to test and enter the query you want to test with. Clicking the Run button will send the query to the endpoint and the response generation process will start.

For more information on testing endpoints, check QvikChat's documentation on Testing Endpoints (opens in a new tab).