mysql-apostrophe

1.0.8 • Public • Published

mysql-apostrophe

Whenever we want to save any field with apostophe in mysql, and we use syntex like var query = INSERT INTO table_name (column1) VALUES ('${var}'); ;

It will throw mysql error if your var is equals to alex's. This NPM is use to avoid this kind of errors. It is not working if you are sending data as JSON stringify.

Example

 
var mysqlApostrophe = require("mysql-apostrophe");
 
var express = require('express');
var app = express();
var bodyParser = require('body-parser')
 
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended:true}));
 
app.use(mysqlApostrophe); //must be after bodyparser
 
 

Install

npm i mysql-apostrophe

License

MIT

Package Sidebar

Install

npm i mysql-apostrophe

Weekly Downloads

1

Version

1.0.8

License

ISC

Last publish

Collaborators

  • ashjha