hops-express
Advanced tools
Comparing version 9.1.1 to 9.3.0
19
app.js
@@ -13,3 +13,3 @@ 'use strict'; | ||
function createApp() { | ||
function createApp(options) { | ||
var app = express(); | ||
@@ -30,12 +30,13 @@ app.use(helmet()); | ||
server.bootstrap(app, hopsConfig); | ||
var filePath = path.join(hopsConfig.cacheDir, 'server.js'); | ||
if (fs.existsSync(filePath)) { | ||
server.registerMiddleware(app.use(helmet.noCache()), require(filePath)); | ||
} else { | ||
console.log( | ||
'No middleware found. Delivering only statically built routes.' | ||
); | ||
if (!options.static) { | ||
var filePath = path.join(hopsConfig.cacheDir, 'server.js'); | ||
if (fs.existsSync(filePath)) { | ||
server.registerMiddleware(app.use(helmet.noCache()), require(filePath)); | ||
} else { | ||
console.log( | ||
'No middleware found. Delivering only statically built routes.' | ||
); | ||
} | ||
} | ||
server.teardown(app, hopsConfig); | ||
return app; | ||
@@ -42,0 +43,0 @@ } |
@@ -6,2 +6,10 @@ # Change Log | ||
<a name="9.3.0"></a> | ||
# [9.3.0](https://github.com/xing/hops/compare/v9.2.0...v9.3.0) (2017-12-14) | ||
**Note:** Version bump only for package hops-express | ||
<a name="9.1.1"></a> | ||
@@ -8,0 +16,0 @@ ## [9.1.1](https://github.com/xing/hops/compare/v9.1.0...v9.1.1) (2017-12-05) |
@@ -29,4 +29,6 @@ #!/usr/bin/env node | ||
} | ||
process.env.HOPS_MODE = argv.static ? 'static' : 'dynamic'; | ||
require('..').runServer(); | ||
if (argv.static) { | ||
process.env.HOPS_MODE = 'static'; | ||
} | ||
require('..').runServer(argv); | ||
}, | ||
@@ -33,0 +35,0 @@ }); |
@@ -7,3 +7,3 @@ 'use strict'; | ||
function runServer(options, callback) { | ||
server.run(createApp(), callback); | ||
server.run(createApp(options), callback); | ||
} | ||
@@ -10,0 +10,0 @@ |
{ | ||
"name": "hops-express", | ||
"version": "9.1.1", | ||
"version": "9.3.0", | ||
"description": | ||
@@ -20,6 +20,6 @@ "Express server to enable server-side rendering of hops applications", | ||
"helmet": "^3.8.2", | ||
"hops-config": "9.1.1", | ||
"hops-server": "9.1.1", | ||
"hops-config": "9.3.0", | ||
"hops-server": "9.3.0", | ||
"mime": "^2.0.3" | ||
} | ||
} |
6366
88
+ Addedhops-config@9.3.0(transitive)
+ Addedhops-server@9.3.0(transitive)
- Removedhops-config@9.1.1(transitive)
- Removedhops-server@9.1.1(transitive)
Updatedhops-config@9.3.0
Updatedhops-server@9.3.0