UNPKG

newbeely-nodejs

Version:

简单易用的轻量级nodejs服务框架. 框架简单到只有组件逻辑,不同的组件提供不同的服务,使用外部的配置文件(只有一个配置文件)方便的组合成一个完整的服务框架. 整个服务使用bearcat(网易开源的nodejs面向切面编程的轻量级框架(AOP))管理,极大的解耦组件间的耦合.(关于代码热更新后续开放).

41 lines (39 loc) 1.27 kB
var Bearcat = require('bearcat'); var Application = function () { this.$id = "application"; this.getComponent = function () { return Bearcat.getBean(require('../../../node_modules/newbeely-nodejs/lib/components/redisComponent/redisComponent.js'), 'dao-rank', { host: "127.0.0.1", port: 6379, auth_pass: "" }); }; }; describe("tools test", function () { before('init bearcat ', function (done) { Bearcat.createApp(); Bearcat.module(Application); Bearcat.use(['application']); Bearcat.start(function () { Bearcat.abb = "ttttttttttttttttt"; done(); }); }); it('tester', function (done) { var tools = Bearcat.getBean(require('../schemas/tools.js')); tools.getID("march", "31", done); }); it('checker', function (done) { var tools = Bearcat.getBean(require('../schemas/tools.js')); tools.check("march", function (err, data) { if (err) done(err); //require("chai").expect(data).to.be.equal("31"); console.log(data); done(); }); }); after('release bearcat', function (done) { Bearcat.stop(); done(); }); });