I need to connect to a database using the mysql module of node_modules, using the ionic 2 framework, in previous projects where I worked with express only easily, but with ionic 2 I do not know how to integrate these, what I have achieved find on the internet do it this way, but the keyword require
does not recognize it and therefore can not find the module.
modulos.import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';
var mySQLLibreria = require('mysql');
/*
Generated class for the ServicioMySQL provider.
See https://angular.io/docs/ts/latest/guide/dependency-injection.html
for more info on providers and Angular 2 DI.
*/
@Injectable()
export class ServicioMySQL {
mySQL;
constructor(public http: Http) {
console.log('Hello ServicioMySQL Provider');
this.mySQL= mySQLLibreria;
}
}