From 8041b4817fe2ca0f9d8a4aeca1b6e5788dbe9f54 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sat, 2 Dec 2017 15:15:20 +0000 Subject: [PATCH] feat: add WebUI Path (#1124) * Create webui.js * Update index.js --- src/http/api/routes/index.js | 1 + src/http/api/routes/webui.js | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/http/api/routes/webui.js diff --git a/src/http/api/routes/index.js b/src/http/api/routes/index.js index 3fa1d75e68..08756fc91c 100644 --- a/src/http/api/routes/index.js +++ b/src/http/api/routes/index.js @@ -14,4 +14,5 @@ module.exports = (server) => { require('./files')(server) require('./pubsub')(server) require('./debug')(server) + require('./webui')(server) } diff --git a/src/http/api/routes/webui.js b/src/http/api/routes/webui.js new file mode 100644 index 0000000000..9d0fc7a625 --- /dev/null +++ b/src/http/api/routes/webui.js @@ -0,0 +1,25 @@ +const resources = require('../../gateway/resources') + +module.exports = (server) => { + const gateway = server.select('API') + + gateway.route([ + { + method: '*', + path: '/ipfs/{cid*}', + config: { + pre: [ + { method: resources.gateway.checkCID, assign: 'args' } + ], + handler: resources.gateway.handler + } + }, + { + method: '*', + path: '/webui', + handler: (request, reply) => { + return reply().redirect().location('/ipfs/QmQLXHs7K98JNQdWrBB2cQLJahPhmupbDjRuH1b9ibmwVa'); + } + } + ]) +}