-
Notifications
You must be signed in to change notification settings - Fork 799
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Add ability to specify port for Electron app #401
- Loading branch information
1 parent
c8b6b17
commit 009d432
Showing
2 changed files
with
20 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
'use strict'; | ||
const PORT = 9100; | ||
|
||
var finalhandler = require('finalhandler'), | ||
http = require('http'), | ||
serveStatic = require('serve-static'), | ||
serve, | ||
server; | ||
|
||
serve = serveStatic(__dirname + '/dist', {index: ['index.html']}); | ||
serve = serveStatic(__dirname + '/app', {index: ['index.html']}); | ||
|
||
server = http.createServer(function(req, res) { | ||
var done = finalhandler(req, res); | ||
serve(req, res, done); | ||
}); | ||
|
||
server.listen(PORT); | ||
|
||
console.log('Server is running on port: ' + PORT); | ||
module.exports = function(port) { | ||
console.log('Server is running on port: ' + port); | ||
return server.listen(port); | ||
}; |