HTTP request with custom properties

Viewed 47

right now i try to do a http get request which sends the two dates "Start" and "End" to the backend:

let vacationDays = await this.http.get(this.baseUrl + 'vacation/getVacationDays/'+start +end, { headers: this.getHeader() }).toPromise()

My router code looks like the following:

this.router.get('/getVacationDays/:start/:end', this.authHandler.isAuthed, (req, res) => this.getDBVacationDays(req, res))

I get no error, but with req.params.start, req.params.end I can not log the parameters. Can you help me out here? Greetings, Leo

1 Answers

You forgot the slash sybmol between start and end

let vacationDays = await this.http.get(this.baseUrl +
   `vacation/getVacationDays/${start}/${end}`, 
   { headers: this.getHeader() }
).toPromise()

Related