diff options
Diffstat (limited to 'paths.js')
| -rw-r--r-- | paths.js | 30 |
1 files changed, 26 insertions, 4 deletions
@@ -1,11 +1,12 @@ const Router = require('koa-router'); const kb = require('./pieces/kb-util.js'); const data = require('./pieces/prepare-streams'); -const prod = require('./data/j.json'); +const products = require('./data/products.json'); +const bench = require('./benchmark/find.js'); // Prefix all routes with: /items const router = new Router({ - //// prefix: '/items' + // prefix: '/items' }); /* simple route example @@ -61,12 +62,20 @@ router.get('/search/:title', (ctx, next) => { next(); }); + + /** other routes + * ///////////////////////////////////////////////////////////////////////////// * + /suggest/<some search string> * + /prepare (products, keywords, linked-terms etc) * + /stats */ + + +// TEST routes +//////////////////////////////////////////////////////////////////////////////// + router.get('/test', (ctx, next) => { // easy test route // test anything ... let result = { success: true, data: [1, 2, 3] }; @@ -76,14 +85,27 @@ router.get('/test', (ctx, next) => { // easy test route router.get('/test/do-data', (ctx, next) => { // easy test route // test anything ... - data.create(); + // data.create( + // 'products', + // 'https://storage.googleapis.com/pythia-files/uploads/json/emarket-products.json' + // ); + data.load_products( + 'https://storage.googleapis.com/pythia-files/uploads/json/emarket-products.json' + ); ctx.body = { success: true, operation: 'create new data' }; next(); }); router.get('/test/json', (ctx, next) => { // easy test route // test anything ... - ctx.body = { t: + new Date(), p: prod }; + ctx.body = { t: + new Date(), p: products }; + next(); +}); + +router.get('/bench/fe', (ctx, next) => { // easy test route + // test anything ... + // ctx.body = bench.compare(); + ctx.body = bench.byFor(); next(); }); |
