Comments (11)
Yes, but what exactly do you mean? The way I use this is by using Express to serve my UI and my API and then if I need a more persistent connection I fire up a Socket.IO server and use that as well (for data or other things).
from electron-with-express.
Thanks for te reply. I want to use this using Electron as main interface and then with Express make the clients can connect to the server (local) and send data to the electron app which will manage the data.
from electron-with-express.
Yes it can do this. Think of it in this way. When Electron fires up it also starts it's own personal web server that it uses. It uses this for serving up it's own UI and it's API but it can do anything you want it to do. It can work in the same tradition as a normal web server and web site but with special super powers that Electron and Node provide.
from electron-with-express.
OKay so in this example only the most basic thing is done. There are some Express routes that provide just a very basic UI. It does nothing more but the Express app could provide an API to a database. It can do anything you want it to in order to provide data. If you want something more complex you can also start up a Socket.IO server for push and pull between backend and frontend. The thing to keep in mind is that these special servers are basically started up for the sole consumption of Electron. The world is basically at your feet, you can do anything you want to do. It's fucking brilliant actually. If you need a more complex example I may be able to be bothered to create one. =)
from electron-with-express.
Ohh thanks for the example, I will try to make something. If I got stuck, can I ask you for some advice?
Thanks for all.
from electron-with-express.
Absolutely, if you need help please reach out! Have fun. =)
from electron-with-express.
First question! How can I run a socket.io server in Electron and connect from Expres web?
from electron-with-express.
Okay, you can start a Socket.IO server in the express-app
in the app.js file. Then you can start a client in the main index.html (in the root of the code repository). Of course you'd probably want to break the code out a bit cleaner than that. I put some code directly in the index.html just as a quick and dirty example but it probably shouldn't live there for long term.
If you want a more complete example I did all this in my YouTube player: https://github.com/frankhale/toby
from electron-with-express.
You still need more help?
from electron-with-express.
Sorry for the late reply. So many thanks for all the help. I'm ok now. Can I ask you for help if I need It?
If you want to take a look at the project It is in a public repo in my profile. The only one with js It is.
Thanks!!
from electron-with-express.
Sure thing!
from electron-with-express.
Related Issues (20)
- Building the application with electron-builder, it doesn't work. HOT 2
- console.log() doesn't work HOT 1
- Support both win32 and win64 HOT 1
- Sending messages to main process from express-app process HOT 6
- electron-with-express rewrite HOT 10
- Express process is not killed if app closes before window has created HOT 8
- Security warnings HOT 4
- Key binding for F1 (Server Log) doesn't work anymore HOT 4
- electron-packager build not starting express server. HOT 3
- After create exe jquery module not found is showin HOT 3
- if access the page from chrome, the express app will report error in log HOT 4
- require('electron').remote.app.getAppPath() no longer working HOT 2
- Productive build, there is no more index.html with line 64 anymore HOT 1
- new version remote electron @electron/remote HOT 3
- License mismatch between package.json and LICENSE HOT 1
- ff059291d16250f548ef05aac52aefdd4507fd09
- Question: Why use a html to load the server file? HOT 9
- add mongodb to the app HOT 2
- How to use ipcRenderer from Express? HOT 3
- Only loading when I packaged using packager and run the exe file. it is not loading the ejs file. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electron-with-express.