本文介绍了电子架构API调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Stackoverflow社区,

Hello Stackoverflow Community,

我目前正在使用Electron涉足跨平台应用程序。
由于我是该主题的新手,因此存在一些不确定性:
在常规网络开发中,我将使用Go(lang)编写一个处理JSON文件的API。
是否可以像离线服务器一样设置Electron来进行API调用?

I'm currently diving in into cross-platform apps with Electron.As I'm a newbie to this topic there are some uncertainties:In "normal" webdevelopment I would write an API in Go(lang) which processes JSON files. Is it possible to set up Electron like an offline server which can make API calls?

请先谢谢您。非常感谢您的帮助。

Thank you in advance. I really appreciate your help.

推荐答案

是的,有可能,这里是一个库演示了这种方法。您可以在文章。它基于此项目-Electron应用程序,该应用程序通过TCP套接字提供API,允许执行Electron的方法以及捕获电子事件。

Yes, it is possible and and here is a library go-astilectron that demonstrates this approach. You can read more in the article How to add a GUI to your Golang app in 5 easy steps (powered by Electron). It's based on this project astilectron - Electron app that provides an API over a TCP socket that allows executing Electron's method as well as capturing Electron's events.

这篇关于电子架构API调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 10:19