data-service

1.5.5 • Public • Published

NPM

Build Status

Data Service

Config File:

{
    "host": "127.0.0.1",
    "database": "database",
    "port": "3306",
    "user": "user",
    "password": "password"
}

Sample Code:

var data_service = require('data-service');
var config = require('./config/mysql.json');
var service = "mysql";
var table = "table";
var id = {id: id};
var data = {field1:"field1", field2:"field2", field3:"field3"};
  
// Connect
data_service.Connect(service, config, function(data) {
    console.log(data);
});
  
// Create
data_service.Create(service, table ,id ,data ,function(data) {
    console.log(data);
});
  
// Read
data_service.Read(service, table ,id ,data ,function(data) {
    console.log(data);
});
  
// Update
data_service.Update(service, table ,id ,data ,function(data) {
    console.log(data);
});
  
// Delete
data_service.Delete(service, table ,id ,data ,function(data) {
    console.log(data);
});
  
// Destroy
data_service.Destroy(service, function(data) {
    console.log(data);
});

Installation

$ npm install data-service

Install dependencies:

$ npm install

Start the example:

Step 1:

$ git clone https://github.com/LeoYehTW/data-service.git
$ npm install
$ node example.js

Step 2: Open "Data Service - Management" Website. (http://127.0.0.1:5000)

Step 3: Change database connection information.

General CRUD Function

  • Create
  • Read
  • Update
  • Delete

Support

Contributors

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i data-service

Weekly Downloads

6

Version

1.5.5

License

MIT

Last publish

Collaborators

  • leoyehtw