mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Added gzip support #82
This commit is contained in:
parent
6f288f00b5
commit
f29883d47f
6 changed files with 20 additions and 9 deletions
|
|
@ -1,10 +1,11 @@
|
|||
define([
|
||||
'http',
|
||||
'node-static',
|
||||
'Server/Api'
|
||||
'Server/Api',
|
||||
'zlib'
|
||||
],
|
||||
|
||||
function (http, nodeStatic, Api) {
|
||||
function (http, nodeStatic, Api, zlib) {
|
||||
|
||||
function HttpServer (options, coordinator) {
|
||||
options.port = options.port || 1234;
|
||||
|
|
@ -20,7 +21,8 @@ function (http, nodeStatic, Api) {
|
|||
HttpServer.prototype.init = function (options) {
|
||||
var self = this;
|
||||
|
||||
var fileServer = new nodeStatic.Server(options.rootDirectory, { cache: options.caching });
|
||||
//gzip true serves gzip file if there is one with .gz next to the original && if browser supports it
|
||||
var fileServer = new nodeStatic.Server(options.rootDirectory, { cache: options.caching, gzip: true });
|
||||
|
||||
this.server = http.createServer(
|
||||
function (req, res) {
|
||||
|
|
@ -48,7 +50,7 @@ function (http, nodeStatic, Api) {
|
|||
break;
|
||||
|
||||
case req.url == '/client.min.js':
|
||||
fileServer.serveFile('./client.min.js', 200, {}, req, res);
|
||||
fileServer.serveFile('./build/client.min.js', 200, {}, req, res);
|
||||
break;
|
||||
|
||||
case req.url == '/require.js':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue