From 385cecfc97b031befcbff9e4159046e9ff863bd5 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Sat, 28 Mar 2015 00:01:49 +0300 Subject: [PATCH] default router index file moved to config; --- config.js | 1 + routes/index.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config.js b/config.js index d69a1d7f..b552f869 100644 --- a/config.js +++ b/config.js @@ -10,6 +10,7 @@ var privateFile = process.env["PRIVATE"] || "private.json"; var privateData = JSON.parse(fs.readFileSync(privateFile, "utf-8")); var config = { + defaultIndex: "/templates/index.html" || process.env["INDEX"], port: process.env["PORT"] || 3000, pub: "./", data: { diff --git a/routes/index.js b/routes/index.js index 2a100647..dbe2d91e 100644 --- a/routes/index.js +++ b/routes/index.js @@ -4,6 +4,7 @@ var path = require("path"); var fs = require("mz/fs"); +var config = require("../config"); function accepts(routes, def) { return function *() { @@ -26,7 +27,7 @@ function accepts(routes, def) { function index(filename) { if (!filename){ - filename = path.join(__dirname, "../templates/index.html"); + filename = path.join(__dirname, "..", config.defaultIndex); } return function *() {