Relative Content

Tag Archive for javascriptroutes

Is Order of Route matters?

const {handleShortUrl,handleViewUrl,handleTest} = require(‘../controllers/url’) router.route(‘/’).post(handleShortUrl) router.route(‘/:url’).get(handleViewUrl) router.route(‘/test’).get(handleTest) when i try to access *router.route(‘/test’).get(handleTest) * is starts using handleViewUrl but when i order them as router.route(‘/’).post(handleShortUrl) router.route(‘/test’).get(handleTest) router.route(‘/:url’).get(handleViewUrl) It works perfectly so how Does this order make it work proper while just shifting one line starts using another method which is HandleViewUrl I just shifted on […]