forked from Mirrors/doipjs
Handle invalid endpoints
This commit is contained in:
parent
c13c65aa5e
commit
c333229e5d
1 changed files with 2 additions and 5 deletions
|
@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
const router = require('express').Router()
|
const router = require('express').Router()
|
||||||
|
const { body, validationResult } = require('express-validator')
|
||||||
const fetcher = require('../../../fetcher')
|
const fetcher = require('../../../fetcher')
|
||||||
const E = require('../../../enums')
|
const E = require('../../../enums')
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
|
@ -40,11 +41,7 @@ const opts = {
|
||||||
|
|
||||||
// Root route
|
// Root route
|
||||||
router.get('/', async (req, res) => {
|
router.get('/', async (req, res) => {
|
||||||
return res.status(400).json({
|
return res.status(400).json({ error: 'Invalid endpoint' })
|
||||||
data: [],
|
|
||||||
error:
|
|
||||||
'Available endpoints: /json/:url, /text/:url, /dns/:hostname, /xmpp/:xmppid, /twitter/:tweetid, /matrix/:roomid/:eventid, /irc/:ircserver/:ircnick',
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// HTTP route
|
// HTTP route
|
||||||
|
|
Loading…
Reference in a new issue