Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

230
Visualizações
Posting a single quote into a Postgres database

I am currently trying to take a string submitted from a form and make an api call to submit the message into the Postgres data base. Everything works sucessfully except when dealing with single quotes. The simplified code is:

const message = form.get('message').replace(/\'/g, "E\'\'")
urlData = ...&reasoning=${message}
methodApi = ...

axios.get(methodApi + urlData);

I am currently using the .replace function above to follow the format when dealing with single quotes. And it works but the message submitted to the database has the E present

example value from db after submission:

testing single quote: E'

When I do not use the .replace function the api gets cut off and wont submit, also just replacing a single quote with \' does not work and two single quotes does not work either.

So basically I've made progress and am trying to have the "E" not show up in the db.

Most likely a simple fix but each time I push the code to the dev environment to test the db it takes about 20 minutes, so asking here while I work on it will save some time.

Thanks and let me know if this is confusing I will be sure to respond asap!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda