1.1.19 • Published 4 years ago

stigma-dvcore v1.1.19

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

"# DLServerCore" You can easily do node.js

##Features

  • supports
    • Create node.js Server
      • cluster
      • ssl
      • web socket
      • remote address
    • Encryption
      • java
    • socketIO
    • DBMS Connection and Execution
      • MSSQL
      • MYSQL

Installation

To use stigma-dvcore in your project, install it via npm:

$ npm install stigma-dvcore --save

Usage

Import the stigma-dvcore into your desired module:

js import

var tools = require("stigma-dvcore");

createServer

var app = require('../app');
var appRootDir = require('app-root-dir').get();
var fs = require('fs');
var tools = require('stigma-dvcore');

var k = fs.readFileSync(appRootDir + '/ssl/key.pem', 'utf8');
var c = fs.readFileSync(appRootDir + '/ssl/cert.pem', 'utf8')

var options = {
	key : k, //https
	cert : c, //https
	cluster : false,
	protocol : 'h',// socket.io: s, http: h
	security : true // true: https, false: http
};

/**
 * Set Creator information
 */
var makers = [];
// makers.push("dev- Jake");
var companys = ["* Proudly created with devlab.kr", "* https://devlab.kr/"];
/**
 * Get port from environment and store in Express.
 */
var port = normalizePort(process.env.PORT || '3030');
tools.createServer(app, port, options, "v0.7.2", makers, companys);

remote Address

router.get('/remoteAddress', function (req, res, next) {
	res.redirect('/aes/remoteAddress?value='+req.query.value);
});
router.get('/remoteaddress', function(req, res, next) {
	tools.aes(res, "encrypt", req.header ( 'x-forwarded-for') || req.connection.remoteAddress + req.query.value, "", "");
});

Encryption

router.post('/', function(req, res, next) {
	tools.aes(res, req.body.type, req.body.data, req.body.key, req.body.iv);
});

DBMS Connection(Response json)

router.post('/json', function (req, res, next) {
	if (!tools.isValid([req.body.isStream, req.body.user, req.body.password, req.body.server, req.body.port, req.body.database, req.body.timeout])) {
		if (res !== undefined && res._headerSent === false) {
			res.send(stringify(tools.tranSQLThrow(("MSSQL", { message: "Invalid data or empty data." }))));
		}
	} else if (!tools.isValid([req.body.query])) {
		if (res !== undefined && res._headerSent === false) {
			res.send(stringify(tools.tranSQLThrow(("MSSQL", { message: "query is empty." }))));
		}
	}

	var cTimeout = tools.mTimeout(req.body.timeout, 0);
    var rTimeout = tools.mTimeout(req.body.timeout, 1000);
    ....
}

DBMS Multi Connection(Response json)

Multi transaction is possible.
//req.body.params
//isValid([params.timeout, params.user, params.password, params.server, params.port, params.database, params.query])

router.post('/', function (req, res, next) {
	tools.multi(req, res);
});

Development

To generate all *.js, *.d.ts and *.metadata.json files:

$ npm run build

To lint all *.ts files:

$ npm run lint
1.1.19

4 years ago

1.1.18

5 years ago

1.1.1-7.1

5 years ago

1.1.17

5 years ago

1.1.16

6 years ago

1.1.15

6 years ago

1.1.14

6 years ago

1.1.13

6 years ago

1.1.12

6 years ago

1.1.11

6 years ago

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago