久久久久久久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?(如何在電子應用程序中訪問相機/網絡攝像頭?)
主站蜘蛛池模板: 亚洲成人精品在线 | 国产精品久久久久久一区二区三区 | 久久久久久久一区 | av一二三区 | 国产黑丝av | 中文成人在线 | 天天干免费视频 | 亚洲欧洲在线视频 | 精品久久久久久久久久久 | 有码在线 | 欧美精品1区2区3区 免费黄篇 | 日本视频中文字幕 | 国产精品久久久久久福利一牛影视 | 成人午夜视频在线观看 | 看羞羞视频免费 | 拍真实国产伦偷精品 | 国产精品久久久乱弄 | 日韩不卡一区二区 | 精品国产一区二区三区观看不卡 | 国产精品高潮呻吟久久 | 日本 欧美 三级 高清 视频 | 中文字幕成人网 | 国产精品人人做人人爽 | 国产日韩精品在线 | 日本精品视频一区二区 | 日本国产高清 | 亚洲资源在线 | 一区二区在线不卡 | 国产精品视频免费观看 | 91黄在线观看 | 日韩久久综合 | 免费成人高清在线视频 | 成人小视频在线 | 国产高清视频一区 | 色狠狠桃花综合 | 国产精品精品视频一区二区三区 | 日韩精品在线播放 | 久久精品欧美一区二区三区不卡 | 美女艹b | 日本天天操 | 亚洲91精品 |