-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(node): create production server
- Loading branch information
1 parent
7a53dcd
commit abed438
Showing
3 changed files
with
21 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var fs = require('fs'); | ||
var http = require('http'); | ||
var serveStatic = require('serve-static'); | ||
var finalhandler = require('finalhandler'); | ||
|
||
var settings = require('./settings').settings; | ||
var host = settings.httpServer.host || 'localhost'; | ||
var port = settings.httpServer.port || 8080; | ||
|
||
var serve = serveStatic('/dist', { 'index': ['index.html'] }); | ||
|
||
var server = http.createServer(function(req, res) { | ||
var done = finalhandler(req, res); | ||
serve(req, res, done); | ||
}) | ||
|
||
server.listen(port, host); | ||
|
||
console.log(host + ':' + port); |
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