dtrhd2850 2019-04-04 16:22 采纳率: 0%
浏览 159
已采纳

Laravel / Lighthouse - 解析为外部API

I have a setup that uses laravel and lighthouse to create a graphql setup. I've gone through the tutorials on lighthouses page and it's worked great. In my use case, however, i'm looking to simplify the use of an xml Soap API using it.

I can't find in the documentation how to do this other than creating "resolvers", which i've managed to do. However these are set to fields..? So in order to return the correct information from the other api i'd have to do one for each field?

I'm getting a little lost.

Simply put, i just need to ask:

How do i plug in an external api so when i make a call with graphql it returns information from the api?

  • 写回答

1条回答 默认 最新

  • dpt1712 2019-04-05 18:06
    关注

    So i ended up using lighthouses built-in artisan function to create a custom resolver:

    php artisan lighthouse:query
    

    The file that is created from this in the graphql folder in the root of laravel allows me to input and output what i need correctly. I'll basically be using this file to do the calls and returning the response.

    Thank you for the help :)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 统计大规模图中的完全子图问题
  • ¥15 使用LM2596制作降压电路,一个能运行,一个不能
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路
  • ¥15 经gamit解算的cors站数据再经globk网平差得到的坐标做形变分析
  • ¥15 phython读取excel表格报错 ^7个 SyntaxError: invalid syntax 语句报错
  • ¥20 @microsoft/fetch-event-source 流式响应问题
  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式