Your First Midio App

In this guide you will learn how to set up a basic web API in Midio using several nodes from the Http package. Create a new project, and let’s begin.

  1. Create our API endpoint

    1. Add a new endpoint by searching for Http Endpoint in the Node Palette.

    1. Configure it to handle requests to /poem with a query param named query using the following path value: /poem?query . Leave the other parameters at their default values.

    2. Your Endpoint node should look like this:

  2. Responding to requests

    1. Add an Http Respond to HTTP Request node and hook it up to the endpoint node we added previously, in order to respond to requests. You can also add some dummy data to the body input if you want.

  3. Test our endpoint using Http.Fetch

    1. The easiest way to test out our endpoint is to click “Go to app” button in the project header, and modify that url to target our new endpoint, which will be something like:

      https://<your-project-name>.midio.dev:<port>/poem?query=testing

  4. Add LLM Chat Complete

    1. Add the open-ai package using the package manager.

      open the package manager
      search for open-ai and install it
    2. Add an instance of OpenAI Chat Complete.

    3. Give it a system message like: “Write a short haiku style poem based on the users request.”

  5. Provide an API key (if you received free OpenAI credits when you signed up for Midio, you can skip straight to step 5.c)

    1. Add it to Midio as a secret

      Open the secrets editor

      Add a new secret

      Give the secret a name

    2. Add an instance of Get Environment Variable , select our key from the dropdown menu, and connect it to the api key input in our Chat Complete node.

  6. Connect the Chat Complete node to our endpoint.

Congratulations! You've made your first AI-driven application in Midio. You can easily experiment with it directly from Midio using the Http Fetch node, like so (pick text for the response type you you're not returning an object):

Further reading

  • Check our our various guides for recipes and examples of how common tasks, like HTTP, working with data and looping is done in Midio.

  • The reference section is a good place to look for definitive information about every aspect of Midio.

    • The available nodes section contains a comprehensive overview of all nodes available out of the box in Midio.

Last updated

Was this helpful?