Im using GitHub Electron to create Desktop application with web technologies.
I'm using Node.js
as the server, my problem is that i don't know how to run the file server.js
just when launching the electron app.
I want to package my app for distribution so that i can run the server without the command line $ node server.js
.
js application locally after closing the terminal or Application, to run the nodeJS application permanently. We use NPM modules such as forever or PM2 to ensure that a given script runs continuously. NPM is a Default Package manager for Node.
Electron will open a window with "Application Electron and Express" as a title. The Express server will run on the background. To check if the server is active, open your browser and go to http://localhost:3000 . You will see a message: "Server is ready!"
Just simply require
the server.js
file in your main file (e.g. app.js
):
var app = require("app")
, server = require("./server")
;
...
And in the server.js
file you can have:
require("http").createServer(function (req, res) {
res.end("Hello from server started by Electron app!");
}).listen(9000)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With