Reputation: 331
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
.
Upvotes: 17
Views: 29161
Reputation: 113475
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)
Upvotes: 37