Make sure you have a running LoopBack 4 application. In this tutorial, we’ll usethe example. You can create this application by running the commandbelow:

    From your LoopBack application, run the following command to installOpenAPI-to-GraphQL and the required dependencies:

    1. npm i --save openapi-to-graphql-cli

    Make sure your LoopBack application is running by going to. If not, you can start it by running thenpm start command.

    Haven’t heard about npx yet? It’s a cool helper provided by npm andavailable out of the box since Node.js 8.x. Learn more in their announcementblog post:Introducing npx: an npm package runner

    That’s it! You’re now ready to try out some tests and requests in the browser at.

    Note:

    Here are some examples of the query and calls:

    • To get all the to-do instances, run this query command:
    1. todos {
    2. id
    3. title
    4. desc
    5. }

    The expected output looks like this:

    1. mutation {
    2. todoControllerCreateTodo(todoInput: {
    3. title: "Take over the universe"
    4. }) {
    5. id
    6. title
    7. }

    The expected output looks like this: