From 4e9571355646c386f9f16c7b1a80e6014a5bfae8 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Tue, 19 May 2015 18:09:46 +0200 Subject: [PATCH] Corrected mistake : swapped controllers.js and posts.js --- lib/controllers.js | 11 +++++------ lib/posts.js | 11 ++++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/controllers.js b/lib/controllers.js index 5fd9d1e..d9b0642 100644 --- a/lib/controllers.js +++ b/lib/controllers.js @@ -7,27 +7,26 @@ var fs = require('fs'); module.exports = function(parent, options){ var verbose = options.verbose; - - fs.readdirSync(__dirname + '/../posts').forEach(function(name){ + fs.readdirSync(__dirname + '/../controllers').forEach(function(name){ // index.js in controller, with function as pages (views.py for django) - var obj = require('./../posts/' + name + '/index'); + var obj = require('./../controllers/' + name + '/index'); // urls.js, just like django urls.py - var urls = require('./../posts/' + name + '/urls'); + var urls = require('./../controllers/' + name + '/urls'); var name = obj.name || name; var app = express(); // allow specifying the view engine if (obj.engine) app.set('view engine', obj.engine); - app.set('views', __dirname + '/../posts/' + name + '/views'); + app.set('views', __dirname + '/../controllers/' + name + '/views'); // generate routes based // on the exported methods verbose && console.log('\t' + name + ':'); for (var key in urls) { - app.post(key, obj[urls[key]]); + app.get(key, obj[urls[key]]); console.log('\t\t' + key + ' -> ' + name + '.' + urls[key]); } console.log(); diff --git a/lib/posts.js b/lib/posts.js index d9b0642..5fd9d1e 100644 --- a/lib/posts.js +++ b/lib/posts.js @@ -7,26 +7,27 @@ var fs = require('fs'); module.exports = function(parent, options){ var verbose = options.verbose; - fs.readdirSync(__dirname + '/../controllers').forEach(function(name){ + + fs.readdirSync(__dirname + '/../posts').forEach(function(name){ // index.js in controller, with function as pages (views.py for django) - var obj = require('./../controllers/' + name + '/index'); + var obj = require('./../posts/' + name + '/index'); // urls.js, just like django urls.py - var urls = require('./../controllers/' + name + '/urls'); + var urls = require('./../posts/' + name + '/urls'); var name = obj.name || name; var app = express(); // allow specifying the view engine if (obj.engine) app.set('view engine', obj.engine); - app.set('views', __dirname + '/../controllers/' + name + '/views'); + app.set('views', __dirname + '/../posts/' + name + '/views'); // generate routes based // on the exported methods verbose && console.log('\t' + name + ':'); for (var key in urls) { - app.get(key, obj[urls[key]]); + app.post(key, obj[urls[key]]); console.log('\t\t' + key + ' -> ' + name + '.' + urls[key]); } console.log();