久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

我應該在電子應用程序中使用什么作為后端?

What should I use as backend in electron application?(我應該在電子應用程序中使用什么作為后端?)
本文介紹了我應該在電子應用程序中使用什么作為后端?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我知道我可以使用 HTML CSS JavaScript 或任何其他前端框架來設計 UI.我什至明白我可以連接到任何遠程 API.如果我想要一個帶有數(shù)據庫的獨立應用程序怎么辦.我應該如何連接到數(shù)據庫?我應該在哪里寫我的應用程序邏輯?我覺得電子中有一個缺失的部分我應該使用像 Express 這樣的節(jié)點 JS Web 框架嗎?或者我應該在不使用任何框架的情況下用純節(jié)點 JS 編寫所有程序邏輯?如果可能的話,編寫電子應用程序的最佳方法是什么,請指出任何工作示例.

I understand I can design the UI with HTML CSS JavaScript or any other frontend framework. I even understand that I can connect to any remote API. what if I want a standalone application with database. How should I connect to the database ? where should I write my application logic? I feel like there is a missing part in electron do I supposed to use a node JS web Framework like Express? or I should write all the program logics in pure node JS without using any framework? What is the best approach to write electron applications if possible please point me any working example.

推薦答案

這完全取決于你.

雖然我們在 Web 應用程序中習慣的客戶端/服務器(前端/后端)模型是一個好主意(關注點分離),但當客戶端和服務器在同一臺機器.

While the client/server (frontend/backend) model we've got used to in web applications is a good idea (separation of concerns), it's not the only way to do things when the client and the server are on the same machine.

Electron 構建在 Node.js 之上.因此,您可以使用通常的 npm 模塊來連接到您想要使用的任何數(shù)據庫系統(tǒng)并取消框架.例如,如果您愿意,您可以編寫代碼以將數(shù)據從數(shù)據庫直接提取到您的 onclick 事件處理程序中.

Electron is built on top of Node.js. So you can use the usual npm modules in order to connect to whatever database system you want to use and do away with frameworks. For example you can write code to fetch data from the database right into your onclick event handler if you desire so.

話雖如此,如果您不小心,您很可能會發(fā)現(xiàn)自己正在處理一堆難以管理的意大利面條代碼.因此,即使您不想要整個客戶端/服務器系統(tǒng), 種結構也是推薦的.

Having said that, odds are you will find yourself dealing with an unmanageable bunch of spaghetti code if you're not careful. So, some kind of structure is recommended even if you don't want an entire client/server system.

此外,您的客戶端"和服務器"不必通過 HTTP 進行通信.接口可以只是普通的函數(shù)(和/或方法)調用.Electron 還有一個消息傳遞系統(tǒng)(例如:https://electronjs.org/docs/api/ipc-main 你可以使用.

Also, your "client" and your "server" don't have to communicate through HTTP. The interface can be just plain function (and/or method) calls. Electron also has a message passing system (for example: https://electronjs.org/docs/api/ipc-main that you may use.

這篇關于我應該在電子應用程序中使用什么作為后端?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯(lián)網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

相關文檔推薦

How to fix BrowserWindow is not a constructor error when creating child window in Electron renderer process(在 Electron 渲染器進程中創(chuàng)建子窗口時如何修復 BrowserWindow 不是構造函數(shù)錯誤) - IT屋-程序員軟件開發(fā)技術
mainWindow.loadURL(quot;https://localhost:3000/quot;) show white screen on Electron app(mainWindow.loadURL(https://localhost:3000/) 在 Electron 應用程序上顯示白屏)
Electron webContents executeJavaScript : Cannot execute script on second on loadURL(Electron webContents executeJavaScript:無法在第二個 loadURL 上執(zhí)行腳本)
how to use electron browser window inside components in angular-cli?(如何在angular-cli的組件內使用電子瀏覽器窗口?)
ElectronJS - sharing redux store between windows?(ElectronJS - 在 Windows 之間共享 redux 存儲?)
How to access camera/webcamera inside electron app?(如何在電子應用程序中訪問相機/網絡攝像頭?)
主站蜘蛛池模板: 亚洲v日韩v综合v精品v | 黄色av网站在线免费观看 | 在线中文字幕国产 | 欧美www在线 | 黄色在线| 国产激情在线观看视频 | 日本不卡在线视频 | 欧美国产精品 | 亚洲精品日韩在线 | 91大片| 亚洲精品在线免费看 | 欧美一区二区三区,视频 | 免费a国产| 国产成人精品a视频一区www | 久久免费国产视频 | 日日操操| 欧美一级在线免费观看 | 超碰一区二区 | 国产精品高潮呻吟久久av野狼 | 在线中文字幕亚洲 | 欧美一级免费 | 天堂综合 | 99国产在线| 精品国产黄a∨片高清在线 成人区精品一区二区婷婷 日本一区二区视频 | 国产精品爱久久久久久久 | 亚洲国产精品久久久 | 亚洲不卡在线观看 | 精品91 | 国产精品亚洲视频 | 插插宗合网| 欧美一区二区三区在线播放 | 国内精品视频免费观看 | 色免费视频 | 欧产日产国产精品视频 | 国产成人影院 | 日韩欧美国产精品 | 亚洲国产精品激情在线观看 | 不用播放器看的av | 久一精品 | 两性午夜视频 | 久久久久无码国产精品一区 |