From dea470a6d93e12b194e63bdc449fd0fae5b78634 Mon Sep 17 00:00:00 2001 From: Jarrett Cruger Date: Mon, 23 Nov 2015 11:24:15 -0500 Subject: [PATCH] [api] expose a local endpoint to fetch local packages --- lib/index-api.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/index-api.js b/lib/index-api.js index f91b6245..0eb9d8ba 100644 --- a/lib/index-api.js +++ b/lib/index-api.js @@ -90,6 +90,13 @@ module.exports = function(config, auth, storage) { stream.pipe(res) }) + app.get('/-/local', can('access'), function (req, res, next) { + storage.get_local(function (err, packages) { + if (err) return next(err) + res.status(200).json(packages) + }) + }) + // searching packages app.get('/-/all/:anything?', function(req, res, next) { var received_end = false