File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,7 +35,8 @@ Put the following in a `server.js` file:
3535const FastBootAppServer = require (' fastboot-app-server' );
3636
3737let server = new FastBootAppServer ({
38- distPath: ' dist'
38+ distPath: ' dist' ,
39+ gzip: true // Optional - Enables gzip compression.
3940});
4041
4142server .start ();
Original file line number Diff line number Diff line change 2626 "aws-sdk" : " ^2.3.4" ,
2727 "basic-auth" : " ^1.0.3" ,
2828 "chalk" : " ^1.1.3" ,
29+ "compression" : " ^1.6.2" ,
2930 "express" : " ^4.13.3" ,
3031 "fastboot" : " ^1.0.0-rc.0" ,
3132 "fastboot-express-middleware" : " ^1.0.0-rc.3" ,
Original file line number Diff line number Diff line change @@ -12,8 +12,12 @@ class ExpressHTTPServer {
1212 this . username = options . username ;
1313 this . password = options . password ;
1414 this . cache = options . cache ;
15+ this . gzip = options . gzip || false ;
1516
1617 this . app = express ( ) ;
18+ if ( options . gzip ) {
19+ this . app . use ( require ( 'compression' ) ( ) ) ;
20+ }
1721 }
1822
1923 serve ( middleware ) {
Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ class FastBootAppServer {
1515 this . notifier = options . notifier ;
1616 this . cache = options . cache ;
1717 this . ui = options . ui ;
18-
18+ this . gzip = options . gzip || false ;
19+
1920 if ( ! this . ui ) {
2021 let UI = require ( './ui' ) ;
2122 this . ui = new UI ( ) ;
@@ -27,7 +28,8 @@ class FastBootAppServer {
2728 this . worker = new Worker ( {
2829 ui : this . ui ,
2930 distPath : this . distPath || process . env . FASTBOOT_DIST_PATH ,
30- cache : this . cache
31+ cache : this . cache ,
32+ gzip : this . gzip
3133 } ) ;
3234
3335 this . worker . start ( ) ;
Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ class Worker {
1010 this . httpServer = options . httpServer ;
1111 this . ui = options . ui ;
1212 this . cache = options . cache ;
13-
13+ this . gzip = options . gzip || false ;
14+
1415 if ( ! this . httpServer ) {
1516 this . httpServer = new ExpressHTTPServer ( {
1617 ui : this . ui ,
You can’t perform that action at this time.
0 commit comments