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 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100