@nakedcreativity/cee-ms-node 0.2.6 → 0.3.0

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.
Files changed (2) hide show
  1. package/index.js +8 -8
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -112,20 +112,20 @@ function ceems(config) {
112
112
 
113
113
  }
114
114
 
115
- ceems.prototype.load = function(path){
115
+ ceems.prototype.load = function(req, res){
116
116
 
117
+ var path = req._parsedUrl.pathname
117
118
  this.site = JSON.parse(fs.readFileSync('./pages/site.json', 'utf8'));
118
- this.pages_map = _.indexBy(this.site.pages, 'url');
119
-
120
- if(this.pages_map[path]){
121
- var page = this.pages_map[path]
119
+ //this.pages_map = _.indexBy(this.site.pages, 'url');
120
+
121
+ if(this.site.pages[path]){
122
+ var page = this.site.pages[path]
122
123
 
123
124
  if(page.redirect){
124
125
  res.redirect(parseInt(page.redirect.type), page.redirect.to)
125
126
  }
126
127
 
127
- var page = JSON.parse(fs.readFileSync('./pages/'+page.handle+'.json', 'utf8'));
128
-
128
+ var page = JSON.parse(fs.readFileSync('./pages/'+page._id+'.json', 'utf8'));
129
129
  return page
130
130
 
131
131
  }else{
@@ -139,7 +139,7 @@ ceems.prototype.load = function(path){
139
139
  ceems.prototype.render = function(req, res, page=null) {
140
140
 
141
141
  if(!page){
142
- page = this.load(req._parsedUrl.pathname)
142
+ page = this.load(req, res)
143
143
  }
144
144
 
145
145
  // get any external data, and save this into the page
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nakedcreativity/cee-ms-node",
3
- "version": "0.2.6",
3
+ "version": "0.3.0",
4
4
  "description": "Cee.ms for Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {