summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWu Cheng-Han2015-09-22 12:06:13 +0800
committerWu Cheng-Han2015-09-22 12:06:13 +0800
commitb6c758f2fc2cb502ed194f2700e033564f2521f4 (patch)
tree35011f183399a28722a0d395b15be4d51562d9de /lib
parent09a1e662f93456156b8906e6e69f5880678bc0dc (diff)
Added server option "useCdn", use template statement to route resources' source
Diffstat (limited to 'lib')
-rw-r--r--lib/response.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/response.js b/lib/response.js
index b8cfab17..1f7fbd54 100644
--- a/lib/response.js
+++ b/lib/response.js
@@ -34,6 +34,7 @@ var response = {
showFeatures: showFeatures,
showNote: showNote,
showPublishNote: showPublishNote,
+ showIndex: showIndex,
noteActions: noteActions,
publishNoteActions: publishNoteActions
};
@@ -55,6 +56,18 @@ function responseError(res, code, detail, msg) {
res.end();
}
+function showIndex(req, res, next) {
+ res.writeHead(200, {
+ 'Content-Type': 'text/html'
+ });
+ var template = config.indexpath;
+ var content = ejs.render(fs.readFileSync(template, 'utf8'), {
+ useCDN: config.usecdn
+ });
+ res.write(content);
+ res.end();
+}
+
function responseHackMD(res, noteId) {
if (noteId != config.featuresnotename) {
if (!Note.checkNoteIdValid(noteId)) {