0

I'm using angular 4 and http services and I want to call a service and pass a string to return a JSON value. my string is '97/422/1883' and my service code is :

getIncomingRelatedById(number) {
this.createAuthenticationHeaders();
return this.http.get(this.domain + '/mail/getIncomingRelatedById/' + number, this.options).map(res => res.json());

} but when i run the code, i get the error below:

http://localhost:3000/mail/getIncomingRelatedById/97/422/1883 404 (Not Found)

how can i send my request now?

update:

and in the server side I have this :

    router.get('/getRelatedById/:id', (req, res) => {
    pool.connect((err, client, done) => {
      if (err) {
        res.json({
          success: false,
          message: err
        });
      } else {
        client.query('select * from get_related_mail($1)', [req.params.id], 
         (err, mail) => {
          done();
          if (err) {
            console.log(err);
            res.json({
              success: false,
              message: err
            });
          } else {
          res.json({
            success: true,
            mail: mail,
          });
        });
      }
    });
  });
fariba.j
  • 1,737
  • 7
  • 23
  • 42

1 Answers1

1

I think this link its helpful https://www.w3schools.com/tags/ref_urlencode.asp

this like has all characters and the values

for your problem this your character '/'==>'%2F'

Rabea AlTaradeh
  • 213
  • 1
  • 9