Tuesday 30 May 2017

Express route with param not working

I have a simple express routes below.

const express = require('express');
const api = express.Router();

api.get('/vacancies', vacancies.getAllVacancies);

api.get('/vacancy/:id', vacancies.getVacancyById);

I intend to use req.params.id in getVacancyById . However, getAllVacancies works , but calling the path

/vacancy/?id=1 is never recognized . I tried vacancy?id=1 many things it just never get called. The route is not recognized at all. 

Please what am i doing wrong ? Any help would be appreciated



via Nuru Salihu

No comments:

Post a Comment