When passing the text in SQL query that has qoutes (for example: I'm --text---) that ' in I'm needs to be doubled up so that server won't crash.
How to do that in javascript? Is there some NPM package or a way to loop through the text and double up the qoutes?
Here is my SQL text:
queryText = `INSERT INTO posts (id, user_id, title, content, image_urls) VALUES(uuid_generate_v4(), '${req.user.id}', '${title}', '${content}', ARRAY [${realImages}] ) RETURNING *`;