From 2676484041e8771257bf99ed223bd9321fe72fa8 Mon Sep 17 00:00:00 2001 From: Geo Halkiadakis Date: Wed, 10 Apr 2024 13:29:01 +0300 Subject: working on a custom fs-cache system --- paths.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'paths.js') diff --git a/paths.js b/paths.js index 2653ff3..7d33877 100644 --- a/paths.js +++ b/paths.js @@ -1,5 +1,7 @@ const Router = require('koa-router'); const kb = require('./pieces/kb-util.js'); +const data = require('./pieces/prepare-streams'); +const prod = require('./data/j.json'); // Prefix all routes with: /items const router = new Router({ @@ -39,6 +41,10 @@ const router = new Router({ */ +// NOTE: set timeout per route (how-to) +// https://stackoverflow.com/questions/66634123/how-to-add-individual-timeout-value-per-specific-route-using-node-js + + // Routes router.get('/search', (ctx, next) => { @@ -68,4 +74,17 @@ router.get('/test', (ctx, next) => { // easy test route next(); }); +router.get('/test/do-data', (ctx, next) => { // easy test route + // test anything ... + data.create(); + 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 }; + next(); +}); + module.exports = router; \ No newline at end of file -- cgit v1.2.3