Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
zeanium-node
Advanced tools
zeanium-node是基于zeanium, 是专门为nodejs开发的后端框架,提供了基础的cache
、cli
、database
、io
、net
、parser
、session
、template
. 基本的OOP使用语法请访问https://github.com/yangyxu/zeanium.
有任务问题可以添加qq群进行咨询
cache
:有数据库缓存
、内存缓存
、redis缓存
等三种cache的实现.cli
: 提供一系列基于zn命令行工具如zn run
.db
: 提供不同数据库标准访问接口, 本框架已经提供基于mysql的实现方案, 也实现sql语句拼接及生成、mysql基于事件队列的事务机制、常见基础model实现及API操作.net
: 网络模块提供http、socket、web socket三种网络服务的实现接口,zeanium-node http模块是基于MVC框架.session
: 提供后台session管理机制, 有内存模式, 数据库模式.template
: 提供静态化模板引擎.$ npm install zeanium-node -g
Node.js 版本 >= 6.0.0.
对于开发者来说这是非常重要的功能,常规的node.js开发需要借助于第三方库如forever, pm2等来守护node进程。使用我们的框架可以在不借助任何库的前提下可以动态开发和部署。如果你的工程代码发生改变,框架自身回去判断是否需要重新编译最新版本, 而且编译速度极快能看到整个编译过程.
zn-plugin-admin
、zn-plugin-dbms
、zn-plugin-wechat
、zn-plugin-alipay
、zn-plugin-workflow
zeanium-node是基于zeanium框架底层实现的后端框架, 提供面向对象编程的继承、封装、多态特性,同理zeanium-node也具备这些特性。想了解更多的面向对象功能请参考zeanium。
db模块定义常规的数据模型和数据访问层接口
//定义数据库模型
zn.define(function () {
//公共数据模型
var model = zn.db.common.model;
//zn.Model是定义数据库模型函数, 返回数据模型.
return zn.Model("zn_rights_user", {
mixins: [
model.Base //继承基础数据模型对象
],
//定义模型属性
properties: {
name: {
value: null, //字段值
type: ['varchar', 100], //字段数据类型
default: '' //创建表字段默认值
},
pwd: {
value: null,
type: ['varchar', 100],
default: ''
},
email: {
value: null,
type: ['varchar', 50],
default: ''
},
phone: {
value: null,
type: ['varchar', 20],
default: ''
},
address: {
value: null,
type: ['varchar', 250],
default: ''
},
avatarImg: {
value: null,
type: ['varchar', 100],
default: ''
},
lastLoginTime: {
value: null,
type: ['datetime'],
format: "date_format({},'%Y-%c-%d %h:%i:%s')",
default: null
}
}
});
})
//定义控制器
zn.define(function () {
return zn.Controller('user',{
methods: {
init: function (args){
//构造函数
},
//定义login的接口
login: {
method: 'GET/POST', //接口可接受的方法
argv: { //接口参数,如值是null则是必填参数
username: null,
password: null
},
value: function (request, response, chain){
this.collection('zn_rights_user')
.selectOne(request.getValue())
.then(function (user){
if(user){
request.session.user = user;
response.success(user);
} else {
response.error('Username or password is incorrect.');
}
}, function (error){
response.error(error.message);
});
}
},
selectUsers: {
method: 'GET/POST', //接口可接受的方法
argv: { //接口参数,如值是null则是必填参数
where: {}
},
value: function (request, response, chain){
this.collection('zn_rights_user')
.select({
fields: ['id','name'],
where: request.getValue('where')
})
.then(function (data){
response.success(data)
}, function (error){
response.error(error.message);
});
}
}
}
});
});
npm install zeanium-node -g
git clone https://github.com/yangyxu/zeanium-node-demo.git
cd zeanium-node-demo
zn run config:zn.workspace.config.js
The terminal will show the message for http server.
npm install
系统启动默认配置是当前目录下的zn.server.config.js, 所以如果服务启动文件是这个文件名就可以直接运行zn run来启动服务。 也可以自定义启动配置文件,则需要运行zn run config:your.config.js
zn run || zn run config:xxx.config.js
如果您启动服务有一下内容输出到控制台则说明启动:
2016-08-17 21:12:44.043 [INFO] [ Begin ] Scanning Path:../www/
2016-08-17 21:12:44.051 [INFO] Loading Application: ../www/__zn__
2016-08-17 21:12:44.059 [INFO] Register Project(Application): __zn__
2016-08-17 21:12:44.060 [INFO] [ End ] Scanning Path(Application:1):../www/
2016-08-17 21:12:44.060 [INFO] [ Begin ] Scanning Path:../bin/
2016-08-17 21:12:44.063 [INFO] [ End ] Scanning Path(Application:0):../bin/
2016-08-17 21:12:44.066 [INFO] http://0.0.0.0:8080
2016-08-17 21:12:44.068 [INFO] http://127.0.0.1:8080
2016-08-17 21:12:44.069 [INFO] You can press [ control + c ] to stop current zeanium server.
FAQs
Zeanium for Node.js, simple http server and custome your business.
The npm package zeanium-node receives a total of 23 weekly downloads. As such, zeanium-node popularity was classified as not popular.
We found that zeanium-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.