1.0.1 • Published 5 years ago

m2-nodejs v1.0.1

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

m2-nodejs

npm.io The package is provided utilities and facilities for nodejs.

Usage

  • Install
npm install m2-nodejs
yarn add m2-nodejs

APIs

  • mysql Provide nodejs how to connect to mysql

prop or functypedescriptionexample
connectfuncGet the mysql connection instance for the params config
escapefuncPrevent SQL-inject attack to escape the params
execSqlfuncExec the sql statement for the params connection, sql
  • redis Provide nodejs how to connect to redis

prop or functypedescriptionexample
connectfuncGet the redis client instance for the params config
setItemfuncSet the item into redis for the params client, key, val
getItemfuncGet the item from redis for the params client, key
delItemfuncRemove the item from redis for the params client, key
  • cookie Provide how to operate cookie in the server

prop or functypedescriptionexample
getCookieExpirefuncGet the cookie expire time for the params {type,offset}}
setServerCookiefuncSet the cookie in the server for the params res, key, val, options
  • http Provide how to http request and response in the server

prop or functypedescriptionexample
getPostDatafuncGet post data via stream for the params req
parseQueryfuncParse query data or the params req
parseCookiefuncParse cookie data for the params req
parseSessionfuncParse session data for the params req,redis
  • model Provide data response model include SuccessModel, ErrorModel

prop or functypedescriptionexample
SuccessModelclassProvide the data model when data will be fetched
ErrorModelclassProvide the error model when data will be rejected
  • util Provide node util function in the server

prop or functypedescriptionexample
readlinefuncProvide the readline instance based on read stream
writeLogfuncWrite the appending log into file
md5funcEncrypt the content by md5
encryptPasswordfuncEncrypt the password by md5 and key