Browse Source

Merge pull request #48 from pdme/master

Fixed version bug
pull/49/head
o1lab 6 years ago committed by GitHub
parent
commit
cbe9ec9091
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      index.js
  2. 1
      lib/util/cmd.helper.js
  3. 3
      lib/xapi.js
  4. 19
      package-lock.json
  5. 3
      package.json
  6. 6
      tests/tests.js

2
index.js

@ -11,12 +11,14 @@ const Xapi = require('./lib/xapi.js');
const cmdargs = require('./lib/util/cmd.helper.js');
const cluster = require('cluster');
const numCPUs = require('os').cpus().length;
const { version } = require('./package.json');
function startXmysql(sqlConfig) {
/**************** START : setup express ****************/
let app = express();
app.set('version', version);
app.use(morgan('tiny'));
app.use(cors());
app.use(bodyParser.json());

1
lib/util/cmd.helper.js

@ -1,7 +1,6 @@
'use strict';
const program = require('commander');
const colors = require('colors');
const pkginfo = require('pkginfo')(module);
const maxCpus = require('os').cpus().length;

3
lib/xapi.js

@ -4,7 +4,6 @@ var Xsql = require('./xsql.js');
var Xctrl = require('./xctrl.js');
var multer = require('multer');
const path = require('path');
const pkginfo = require('pkginfo')(module);
const v8 = require('v8'),
os = require('os');
@ -444,7 +443,7 @@ class Xapi {
let version = {};
version['Xmysql'] = pkginfo.version;
version['Xmysql'] = this.app.get('version');
version['mysql'] = await this.getMysqlHealth();
version['node'] = process.versions.node;
res.json(version);

19
package-lock.json generated

@ -1,6 +1,6 @@
{
"name": "xmysql",
"version": "0.4.8",
"version": "0.4.9",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -621,9 +621,9 @@
}
},
"nan": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz",
"integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=",
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.11.0.tgz",
"integrity": "sha512-F4miItu2rGnV2ySkXOQoA8FKz/SR2Q2sWP0sbTxNxz/tuokeC8WxOhPMcwi0qIyGtVn/rrSeLbvVkznqCdwYnw==",
"dev": true
},
"negotiator": {
@ -674,11 +674,6 @@
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
},
"pkginfo": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz",
"integrity": "sha1-tUGO8EOd5UJfxJlQQtztFPsqhP8="
},
"process-nextick-args": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
@ -824,9 +819,9 @@
"dev": true
},
"sleep": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/sleep/-/sleep-5.1.1.tgz",
"integrity": "sha1-h4+h1E0I7rDyb7IBjvhinrGjq5Q=",
"version": "5.2.3",
"resolved": "https://registry.npmjs.org/sleep/-/sleep-5.2.3.tgz",
"integrity": "sha512-vC05N1XqgIiPIj6tEq7wt0R32aTycJv4Ymo/jwSEp2PkeU1GCJ1tkl+RdYZEo7Gjebq8QQuhFuEe7vsyVGlFRA==",
"dev": true,
"requires": {
"nan": ">=2.5.1"

3
package.json

@ -33,8 +33,7 @@
"express": "^4.16.1",
"morgan": "^1.9.0",
"multer": "^1.3.0",
"mysql": "^2.15.0",
"pkginfo": "^0.4.1"
"mysql": "^2.15.0"
},
"devDependencies": {
"mocha": "^5.2.0",

6
tests/tests.js

@ -8,7 +8,7 @@ var whereClause = require('../lib/util/whereClause.helper.js')
var should = require('should');
var request = require('supertest')
const cmdargs = require('../lib/util/cmd.helper.js');
const pkginfo = require('pkginfo')(module);
const { version } = require('../package.json');
var args = {}
var app = {}
@ -34,7 +34,7 @@ describe('xmysql : tests', function () {
mysqlPool = mysql.createPool(args)
app = express()
//app.use(morgan('tiny'))
app.set('version', version)
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({
extended: true
@ -1895,7 +1895,7 @@ describe('xmysql : tests', function () {
return done(err);
}
res.body['Xmysql'].should.equals(pkginfo.version);
res.body['Xmysql'].should.equals(version);
res.body['mysql'].should.not.equals("");
res.body['node'].should.not.equals("");

Loading…
Cancel
Save