0.3.5 • Published 6 years ago

blueskyfish-express-mysql v0.3.5

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

BlueSkyFish Express MySql

BlueSkyFish Express MySql

A database connector and middleware to mysql server for micro services

A middleware for the express microservices

Breaking Change switch to yarn.

Example

import * as express from 'express';
import { Http, Env } from 'bluesykfish-express-commons';

const app = express();

const dbConfig = {
    host: Env.fromEnv('DB_HOST') || 'localhost',
    port: Env.fromEnvNumber('DB_PORT', 3306),
    user: Env.fromEnv('DB_USER') || 'root',
    database: Env.fromEnv('DB_DATABASE'),
    password: Env.fromEnv('DB_PASSWORD')
};

app.use(withDB(dbConfig));

app.get('/users', async (req, res) => {
    const db = req.dbConn;
    const users = await db.query('SELECT * FROM users WHERE status = {status}', { status: 'ok'});
    Http.sendData(res, users);
});

Requirements

Global installed typescript. npm install --global typescript.

The library is written in Typescript. During the installation of the library it will be compiled into Javascript ES2015 modules.

Installation

$ npm install -S blueskyfish-express-mysql

Dependencies

All libraries from blueskyfish-express-* and depended applications should use the same version of the dependencies node modules.

nameVersion
express4.16.3
lodash4.17.10
moment2.22.1
mysql2.15.0
--------------------------------------
mocha5.1.1
ts-node6.0.3
typescript2.8.3

History

VersionDateDescription
0.3.32018-05-11update libraries.
0.3.22018-05-10improve db error message. clean unused constants
0.3.12018-05.02adjust tsc options
0.2.12018-05-01switch to yarn
0.1.02018-04-20add querySingleton method. improve the js documentation
0.0.132018-04-13adjust the version of the depended node modules.
0.0.112018-03-20NULL is a sql NULL
0.0.102018-02-22adjust the version of the depended node modules.
0.0.92018-02-18adjust the version of blueskyfish-express-commons
0.0.82018-01-13log db configuration only in Trace log level
0.0.42018-01-24get database connection from express request.
0.0.22018-01-24fixed the typescript error for express type.
0.0.12018-01-21Initial the library. It is extract from my other internal projects.

License

The MIT License

Copyright 2018 BlueSkyFish

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0.3.5

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.1.0

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago