From c333229e5dfebb04d9d3ed1eda2a0a456e046ea4 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Thu, 15 Apr 2021 14:49:25 +0200 Subject: [PATCH] Handle invalid endpoints --- src/proxy/api/v2/index.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/proxy/api/v2/index.js b/src/proxy/api/v2/index.js index 2b157d6..8ad4a03 100644 --- a/src/proxy/api/v2/index.js +++ b/src/proxy/api/v2/index.js @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ const router = require('express').Router() +const { body, validationResult } = require('express-validator') const fetcher = require('../../../fetcher') const E = require('../../../enums') require('dotenv').config() @@ -40,11 +41,7 @@ const opts = { // Root route router.get('/', async (req, res) => { - return res.status(400).json({ - data: [], - error: - 'Available endpoints: /json/:url, /text/:url, /dns/:hostname, /xmpp/:xmppid, /twitter/:tweetid, /matrix/:roomid/:eventid, /irc/:ircserver/:ircnick', - }) + return res.status(400).json({ error: 'Invalid endpoint' }) }) // HTTP route