From 19d8a1315cfaa51cb342570cd31df525e56e0513 Mon Sep 17 00:00:00 2001 From: Jules Date: Sat, 31 Mar 2018 09:10:55 -0400 Subject: fix router order --- lib/db/index.js | 2 +- lib/index.js | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/db/index.js b/lib/db/index.js index 573528d..6e36602 100644 --- a/lib/db/index.js +++ b/lib/db/index.js @@ -31,7 +31,7 @@ db.getRandom = function () { } db.getRandomAscii = function () { return ShaderImage.query(function(qb){ - qb.where("tag", "=", "ascii").orderBy(knex.raw('RAND()')).limit(1) + qb.where("tag", "ascii").orderBy(knex.raw('RAND()')).limit(1) }).fetch() } db.getIndex = function(limit, offset) { diff --git a/lib/index.js b/lib/index.js index 29baa70..781ac04 100644 --- a/lib/index.js +++ b/lib/index.js @@ -45,6 +45,11 @@ site.init = function(){ res.json(img) }) }) + app.get("/p/get/randomascii", function(req, res){ + db.getRandomAscii().then(function(img){ + res.json(img) + }) + }) app.get("/p/get/", function(req, res){ db.getLatest().then(function(img){ res.json(img) @@ -78,12 +83,6 @@ site.init = function(){ }) }) - app.get("/p/get/randomascii", function(req, res){ - db.getRandomAscii().then(function(img){ - res.json(img) - }) - }) - /* shaderblaster / asciiblaster apis */ app.post("/cgi-bin/im/shader/upload", multer_upload.single('qqfile'), function(req, res){ var now = Math.floor(Date.now() / 1000) -- cgit v1.2.3-70-g09d2