graph_maker
v1.5.6
Published
## How to use it :
Downloads
2
Readme
Module to create statistics in your sql bdd.
My first module npm :)
How to use it :
Using npm :
$ npm i graph_maker
In your code :
makeAGraph ('new_profil', sqlConf);
new_profil => Give the title for insert in raw in a new sql table.
sqlConf => insert your conf request.
Exemple file set sql:
const mysql = require('mysql');
export const setFile = mysql.createConnection({
host: 'localhost',
user: '',
password: '',
database: '',
});
Example of the function in the code :
import express from 'express';
import passport from 'passport';
import graphMaker from 'graph_maker';
import { setFile } from '../../setFile';
const router = express.Router();
/* GET user with id. */
router.get('/:id', passport.authenticate('jwt', { session: false }), (req, res) => {
setFile.query('SELECT `first_name`,`last_name`, `pseudo`, `email`, `photo_profil` FROM _User WHERE id=? ;', req.params.id, (err, result) => {
if (err) {
res.status(500);
} else {
res.status(200).json({
result,
});
}
});
graphMaker('post', setFile);
});
export default router;
Thank you and enjoy ^^