Hi I am trying to create a project using Node.js node-xmpp NPM. I do not know how do I make MySql as the database to store newly created users, I can create a DB on MySql in my localhost but how do I connect Node-xmpp to that database.
You can try the following:-
Install mysql using npm install mysql. Also you need to install express using npm.
Sample Code
var express = require('express');
var app = express();
var connection = require('express-myconnection');
var mysql = require('mysql');
app.use(
connection(mysql,{
host: 'hostname',
user: 'DBUser',
password : 'DBPassword',
port : 3306, //port mysql
database:'DBName'
},'pool') //or single
);
Which XMPP server are you using ?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.