Giter Club home page Giter Club logo

Comments (11)

frankhale avatar frankhale commented on May 26, 2024

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.

Xelarey97 avatar Xelarey97 commented on May 26, 2024

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.

frankhale avatar frankhale commented on May 26, 2024

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.

frankhale avatar frankhale commented on May 26, 2024

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.

Xelarey97 avatar Xelarey97 commented on May 26, 2024

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.

frankhale avatar frankhale commented on May 26, 2024

Absolutely, if you need help please reach out! Have fun. =)

from electron-with-express.

Xelarey97 avatar Xelarey97 commented on May 26, 2024

First question! How can I run a socket.io server in Electron and connect from Expres web?

from electron-with-express.

frankhale avatar frankhale commented on May 26, 2024

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.

frankhale avatar frankhale commented on May 26, 2024

You still need more help?

from electron-with-express.

Xelarey97 avatar Xelarey97 commented on May 26, 2024

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.

frankhale avatar frankhale commented on May 26, 2024

Sure thing!

from electron-with-express.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.