@nakedcreativity/cee-ms-node 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +7 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -134,6 +134,9 @@ function ceems(config) {
|
|
|
134
134
|
ceems.prototype.load = function(req, res){
|
|
135
135
|
|
|
136
136
|
var path = req._parsedUrl.pathname.substring(1)
|
|
137
|
+
if(path == '')
|
|
138
|
+
path = 'home'
|
|
139
|
+
|
|
137
140
|
this.site = JSON.parse(fs.readFileSync('./pages/site.json', 'utf8'));
|
|
138
141
|
//this.pages_map = _.indexBy(this.site.pages, 'url');
|
|
139
142
|
|
|
@@ -157,7 +160,9 @@ ceems.prototype.load = function(req, res){
|
|
|
157
160
|
// 404
|
|
158
161
|
else{
|
|
159
162
|
console.log('404 for ',path)
|
|
160
|
-
res.status(404)
|
|
163
|
+
res.status(404)
|
|
164
|
+
// .send('Sorry, this page does not exist');
|
|
165
|
+
this.render(req, res, JSON.parse(fs.readFileSync('./pages/healthcare.json', 'utf8')))
|
|
161
166
|
}
|
|
162
167
|
|
|
163
168
|
|
|
@@ -186,7 +191,7 @@ ceems.prototype.render = function(req, res, page=null) {
|
|
|
186
191
|
if(this.config.whitelistedCookies){
|
|
187
192
|
page.cookies = []
|
|
188
193
|
_.each(this.config.whitelistedCookies, cookieName=>{
|
|
189
|
-
if(req.cookies[cookieName]){
|
|
194
|
+
if(req.cookies && req.cookies[cookieName]){
|
|
190
195
|
page.cookies[cookieName] = req.cookies[cookieName]
|
|
191
196
|
}
|
|
192
197
|
})
|